CF1268B Domino for Young 黑白染色
这个黑白染色的思路真的是很巧妙啊
code:
#include <cstdio> #include <string> #include <algorithm> #define ll long long using namespace std; namespace IO { void setIO(string s) { string in=s+".in"; freopen(in.c_str(),"r",stdin); } }; ll ans[2]; int main() { // IO::setIO("input"); int i,j,n,x; scanf("%d",&n); for(i=1;i<=n;++i) { scanf("%d",&x); ans[i%2]+=x/2; ans[(i+1)%2]+=x-x/2; } printf("%lld\n",min(ans[0],ans[1])); return 0; }