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

for(;scanf("%d",&n);)----> while(scanf("%d", &n)!=EOF)

Posted by lastone at 2006-12-27 13:29:10 on Problem 2551
In Reply To:这个程序为什么会超时啊? Posted by:pxwzzzz at 2006-12-27 12:54:05
> #include<stdio.h>
> 
> int main(){
> 	int n,i,j;
> 	
> 	for(;scanf("%d",&n);){
> 
> 		if(n){
> 			i=1;
> 			j=1;
> 			while(i!=0){
> 				i=(i*10+1)%n;
> 				j++;
> 			}
> 			printf("%d\n",j);}
> 		else
> 			return 1;
> 	}
> 	return 1;
> }

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