https://codeforces.com/contest/1269/problem/D
題意:
給出一個單調不增的格子列,用1*2或者2*1的格子去填,問最多多少個。
解析:
假設如上方式染色,那麼填充的條一定是一黑一白。大膽猜測數量爲黑白格子中較少的那個。
代碼:
/*
* Author : Jk_Chen
* Date : 2020-02-02-12.43.33
*/
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define rep(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define per(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define mmm(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define pill pair<int, int>
#define fi first
#define se second
#define debug(x) cerr<<#x<<" = "<<x<<'\n'
const LL mod=1e9+7;
const int maxn=1e5+9;
const int inf=0x3f3f3f3f;
LL rd(){ LL ans=0; char last=' ',ch=getchar();
while(!(ch>='0' && ch<='9'))last=ch,ch=getchar();
while(ch>='0' && ch<='9')ans=ans*10+ch-'0',ch=getchar();
if(last=='-')ans=-ans; return ans;
}
#define rd rd()
/*_________________________________________________________begin*/
int main(){
int n=rd;
LL x=0,y=0;
int f=0;
while(n--){
int p=rd;
if(f)x+=p/2,y+=(p+1)/2;
else y+=p/2,x+=(p+1)/2;
f=!f;
}
printf("%lld\n",min(x,y));
return 0;
}
/*_________________________________________________________end*/