Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- long long conv(long long a)
- {long i,p,result;
- for(i=0,p=10;(a%p/10)!=a||i==1;p*=10,i++)
- {
- if(a%10==1)
- {
- result+=pow(2,i);
- }
- a/=10;
- }
- printf("%lld",result);
- return result;
- }
- int main()
- {long long x;
- FILE *in=fopen("dane.txt","rt"), *out=fopen("wyniki.txt","wt");
- while(feof(in)==0)
- {fscanf(in,"%lld",&x);
- x=conv(x);
- fprintf(out,"%lld",x);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement