Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
173620 | 简晨希1314 | 高精度阶乘 | C++ | No Test Data | 0 | 0 MS | 0 KB | 639 | 2024-08-20 22:13:26 |
#include<bits/stdc++.h> #define ll long long using namespace std; char a[1000007]; int main() { int n,str = 1; scanf("%d",&n); a[0] = 1; for(int i=2;i<=n;i++) { int carry = 0,up = 0; int j; for(j=0;j<str;j++) { up = carry % 10; carry/=10; carry += ((a[j])*i + up)/10; a[j] = ((a[j])*i + up)%10; } while(carry) a[j++] = carry%10,carry/=10; str = j; } int i = str; printf("%d!=",n); while(i) putchar(a[i-1]+'0'),i--; printf("\n"); return 0; }