Cod sursa(job #1160597)
| Utilizator | Data | 30 martie 2014 17:38:03 | |
|---|---|---|---|
| Problema | Koba | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.64 kb |
#include <cstdio>
#include <cstring>
using namespace std;
char x[35];
int main()
{
freopen("kbiti.in","r",stdin);
freopen("kbiti.out","w",stdout);
int m,t,i,j;
long long sol,cur;
scanf("%d\n",&t);
for(i=0;i<t;i++)
{ sol=0;
cur=0;
fgets(x,35,stdin);
m=strlen(x)-1;
for(j=0;j<m;j++)
{
if(m-j-1>29)
{
cur=(x[j]-48)*(1<<(29));
cur*=(1<<(m-j-30));
sol+=cur;
}
else sol+=(x[j]-48)*(1<<(m-j-1));
}
sol++;
printf("%lld\n",sol);
}
}
