题目链接:https://www.tyvj.cn/Problem_Show.aspx?id=1018
范围只有20,在long long Int范围内。
1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 using namespace std; 5 int main(void) 6 { 7 freopen("in1.txt", "r", stdin); 8 int n, k, h, a[10]; long long int s=1; scanf("%d%d",&n,&k); h=k; 9 for(int i=1;i<=n;++i)s*=i; 10 while (s%10==0) s/=10; 11 while (k--) if(s) a[k]=s%10,s/=10; else break; 12 for (int i=k+1;i<=h-1;++i)printf("%d",a[i]);printf("\n"); 13 return 0; 14 }
=_=