题目:
样例:
代码:
#include<stdio.h>
#include<string>
#include<iostream>
using namespace std;
int main(){
int n;
while(scanf("%d",&n)!=EOF){
if(n==0||n==1){
printf("%d\n",1);
continue;
}
string num="1";
string ans;
for(int i=2;i<=n;i++){
int len =num.length();
int c=0;
int p=0;
ans="";
for(int j=0;j<len;j++){
int x=(num[j]-'0')*i+c;
ans+=x%10+'0';
c=x/10;
}
while(c!=0){
ans+=c%10+'0';
c/=10;
}
num=ans;
}
string ans1(ans.rbegin(),ans.rend());
cout<<ans1<<endl;
}
return 0;
}