PKU 2710 Consecutive Digits
http://poj.org/problem?id=2710
7進数で表される小数計算を行えというような問題。
筆算の要領でやりました。
int ans[300]; main(){ int T; cin>>T; rep(se,T){ int n,d,b,e; cin>>n>>d>>b>>e; printf("Problem set %d: %d / %d, base 7 digits %d through %d: ",se+1,n,d,b,e); n%=d; int mo=0; rep(i,300){ n*=7; ans[i]=n/d; n-=n/d*d; } rep(i,e-b+1)cout<<ans[b+i]; cout<<endl; } }