#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;
}
請問系統哪裡不行做?
#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;
}
請問系統哪裡不行做?