Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

输出7进制小数点后面的第b位到e位,从第0位开始

Posted by water123 at 2010-11-22 11:06:22 on Problem 2710
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator