Just the Facts

来源:互联网 发布:php能开发什么 编辑:程序博客网 时间:2024/06/05 11:51


https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=7&problem=509&mosmsg=Submission+received+with+ID+15627206

#include<iostream>
using namespace std;
int main()
{
 int a[10010]={1};
 int i,j,x;
 for(i=1;i<=10000;i++)
 {
  a[i]=a[i-1]*i;
  while(a[i]%10==0)
   a[i]/=10;
  a[i]%=100000;
 }
 while(cin>>x)
  printf("%5d -> %d\n",x,a[x]%10);
 return 0;
}

0 0