http://projecteuler.net/problem=16
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
int ans[305];
memset(ans,0,sizeof(ans));
ans[0] = 1;
int carry = 0;
int i,j;
for(i = 1; i <= 1000; i++)
{
carry = 0;
for(j = 0; j <= 303; j++)
{
ans[j] *=2;
ans[j]+= carry;
carry = ans[j] /10;
ans[j] %= 10;
}
}
int sum = 0;
for(i = 0; i < 305; i++)
{
sum += ans[i];
}
printf("%d\n",sum);
return 0;
}