Codeforces Round #326 (Div. 2)
A. Duff and Meat
There is no need to say much about this easy problem, just keep track of the minimum value.
B. Duff in Love Just use the fast mod method to find each prime factor, and if the answer cannot be divided by this prime factor, multiply it.
__author__ = 'GCA'
// Created by GCA on 2015/10/19
#include using namespace std;
const int maxn = 1000105;
int a[maxn];
int n;
int main() {
memset(a, 0, sizeof(a));
scanf("%d", &n);
for (int i = 0; i < n; i++) {
int t;
scanf("%d", &t);
a[t]++;
}
int ans=0;
for (int i = 0; i < maxn; i++) {
ans += a[i]%2;
a[i+1]+=a[i]/2;
}
printf("%d\n",ans);
}