| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:纪念In Reply To:纪念 Posted by:Cathy11 at 2008-04-04 01:36:47 > 在此纪念,俺100啦~~三位数
俺也是第100个水题了,,哈哈 奖励大家,,虽然不是高效的算法,但是能AC..嘿嘿
以后开始要做点算法题了
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
using namespace std;
int main()
{
int n,a[10001]={1},t=1;
for(int i=1;i<=10000;i++)
{
t=t*i;
while(!(t%10)||(t>100000))
{
if(t%10==0)
t/=10;
t=t%100000;
}
a[i]=t%10;
}
while(cin>>n)
{
cout<<setw(5)<<n<<" -> "<<a[n]<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator