hi(){ excuse me for my trivial question ; can anyone help me and say what's the problem for the answer of "588c" (duff and lifting weights ) ?! ; }
include
using namespace std; int main(){ long n, i, a, m[1001000], b = 0, c = 0;
cin >> n;
for (i = 0; i < n; i++){
cin >> a;
m[a]++;
if (c < a);
c = a;
}
for (i = 0; i < c; i++){
m[i] = m[i] % 2;
m[i + 1] += m[i] / 2;
}
for (i = 0; i < c + 10; i++){
if (m[i] != 0)
b++;
}
cout << b;
}








In first, don't use semicolon after "if (c < a)". Because in your variant in c last item, but not max. Also, if you want use c, you should use "c+20" in loops, but not "c+10" and not just "c".