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

Re:很简单,方法很重要

Posted by liuenquan at 2008-12-31 14:59:35 on Problem 2551
In Reply To:很简单,方法很重要 Posted by:fly_away at 2006-08-05 22:29:10
> #include<iostream>
> #include<cmath>
> using namespace std;
> 
> int main()
> {
> 	unsigned n, a, total;
> 	while(cin>>n)
> 	{
> 		a = total = 1;
> 		a %= n;
> 		while(a)
> 		{
> 			a = a * 10 + 1;
> 			total++;
> 			a %= n;
> 		}
> 		cout<<total<<endl;
> 	}
> 	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