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

(a+b)%d=(a%d+b%d)%d

Posted by bryant03 at 2014-08-17 16:55:27 on Problem 2551
#include <stdio.h>
int main()
{
	int n,i;
	long long num;
	while(scanf("%d",&n)!=EOF)
	{
		num=1;
		for(i=1;;i++)
		{
			if(num%n==0)
				break;
			num=num*10%n+1;
		}
		printf("%d\n",i);
	}
	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