#1139: CE!!


w11123 (溫卡磊)

學校 : 國立花蓮高級中學
編號 : 3467
來源 : [114.37.238.137]
最後登入時間 :
2017-06-16 00:14:42
c055. 00568 - Just the Facts -- UVa568 | From: [61.231.198.88] | 發表日期 : 2009-01-03 13:15

#include<stdlib.h>
#include<stdio.h>
#define MAX 10001
int the_ans[MAX]={0};
int main()
{
      int n,i;
      while(scanf("%d",&n)!=EOF)
          {
              if(the_ans[n]==0)
                 {
                     long ans=1;
                     for(int i=2; i<=n;i++)
                       {
                           ans*=i;
                           while(ans%10==0)
                             ans/=10;
                           if(ans>100000)
                             ans%=100000;
                        }
                     ans%=10;
                     the_ans[n]=ans;
                 }     
              printf("%5d -> %d\n", n, the_ans[n]);
          }
return 0;
}

 

請問系統哪裡不行做?

 
#8208: Re:CE!!


cuh127 (futurhack~~~~~興國猩國也(絕對沒有在污辱女性))

學校 : 臺南市私立興國高級中學
編號 : 28132
來源 : [203.68.26.150]
最後登入時間 :
2014-04-02 16:51:03
c055. 00568 - Just the Facts -- UVa568 | From: [118.233.170.236] | 發表日期 : 2013-09-20 14:54

#include
#include
#define MAX 10001
int the_ans[MAX]={0};
int main()
{
      int n,i;
      while(scanf("%d",&n)!=EOF)
          {
              if(the_ans[n]==0)
                 {
                     long ans=1;
                     for(int i=2; i<=n;i++)只有在c++才可用
                       {
                           ans*=i;
                           while(ans%10==0)
                             ans/=10;
                           if(ans>100000)
                             ans%=100000;
                        }
                     ans%=10;
                     the_ans[n]=ans;
                 }     
              printf("%5d -> %d\n", n, the_ans[n]);
          }
return 0;
}

 

請問系統哪裡不行做?


 
ZeroJudge Forum