PKU ACM 1604 Just the Facts http://acm.pku.edu.cn/JudgeOnline/problem?id=1604

题目很水,代码也写得很面,没有什么好说的,基础题!
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
int aa,bb;
while (scanf("%d",&bb)!=EOF)
{
   aa=bb;
   long sum=0;
   long temp=1;
   while (aa!=1)
   {
          temp=aa*temp;
    if(temp%10==0)
    {
     temp=temp/10;
    }
    temp=temp%100;
    aa--;
   }  
   while (temp%10==0)
   {
    temp=temp/10;
   }
        sum=temp%10;
   cout<<setw(5)<<right<<bb<<" -> "<<sum<<endl;
}
return 0;
}

posted on 2011-05-06 19:22  _Clarence  阅读(140)  评论(0编辑  收藏  举报

导航