Digits' Sum
Description
Give you a integer N
now, what is the sum of the digits of the number 2^N ?
Input
Output
Sample input
0
Sample output
26
#include <iostream>
#include "algorithm"
#include "cstdio"
#include "cmath"
#include "cstring"
using namespace std;
int excel[70];
int len(int opp)
{
int i, sum = 0;
long long s = 1;
while(opp--) s *= 2;
while(s)
{
sum += s%10;
s /= 10;
}
return sum;
}
int main()
{ //freopen("1.in", "r", stdin);
int i, k;
for(i = 1; i <= 62; i++)
excel[i] = len(i);
excel[0] = 1;
excel[63] = 89;//特殊处理
excel[64] = 88;
while(cin>>k) cout<<excel[k]<<endl;
return 0;
}