Cod sursa(job #574867)

Utilizator mening12001Andrei Geogescu mening12001 Data 7 aprilie 2011 17:23:03
Problema Next Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include<iostream.h>
#include<string.h>
#include<fstream.h>
char a[1000000],b;
long long c,k,o=0,g,z=-1,i,p,x,d=0,zz;
int main()
{ifstream f("next.in");
ofstream h("next.out");
f.getline(a,1000000);
f>>c;
zz=c;
while(zz!=0)
{zz=zz/10;
k++;}
p=strlen(a)-2;
while(z<=p/*&&p-z>=k*/)
{if(o<c)
while(o<c)
{z=z+1;
b=a[z];
g=atoi(&b);
o=o*10+g;}	
x=o%c;
if(x!=0)
{d=d*10+(o-x)/c;
o=x;}
else
{d=d*10+o/c;
if(o/c!=1)
o=o/c;
else
o=0;}}
h<<d*c+c;
return 0;}