Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
输出7进制小数点后面的第b位到e位,从第0位开始#include<stdio.h> int main(){ int n,d,b,e,s,t,i,j,k,result; scanf("%d",&t); for(k=1;k<=t;k++){ scanf("%d%d%d%d",&n,&d,&b,&e); if(d==0)return 1; printf("Problem set %d: %d / %d, base 7 digits %d through %d: ",k,n,d,b,e); n=n%d; for(i=0;i<b;i++){ n=(n*7)%d; } for(i=b;i<=e;i++){ n*=7; result=n/d; n%=d; printf("%d",result); } printf("\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator