题目链接:51Nod - 1596
水题,肯定是能组合就组合。
AC代码:
#pragma GCC optimize("-Ofast","-funroll-all-loops")
#include<bits/stdc++.h>
//#define int long long
using namespace std;
const int N=1e6+50;
int cnt[N],n,x,res;
signed main(){
cin>>n;
for(int i=1;i<=n;i++){
scanf("%d",&x); cnt[x]++;
while(cnt[x]>=2) cnt[x]-=2,cnt[++x]++;
}
for(int i=0;i<N;i++) if(cnt[i]) res++;
cout<<res;
return 0;
}