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

代码说明一切

Posted by xuchang at 2011-01-20 11:10:57 on Problem 1604
#include <iostream>
using namespace std;
__int64 data[10005];
int main()
{
	data[0]=1;
	data[1]=1;
	for(int i=2;i<10005;i++)
	{
		data[i]=data[i-1]*i;
		while(data[i]%10==0)
			data[i]/=10;
	        data[i]%=100000; //这个数可以取得越大越安全,不过过这一题100000足够
	}
	int n;
	while(cin>>n)
	{
		printf("%5d",n);
		printf(" -> ");
		int ans=0;
		printf("%d\n",data[n]%10);
	}
	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