稻花香里说丰年,听取WA声一片, 求调.

P1591 阶乘数码

addBIG这个函数你也没有用啊? ![logo](https://img.soogif.com/TDE7dsI3N8fR8dStcoTXkmAfNH7Jk5f2.jpeg_jpg)
by songlll @ 2023-09-01 18:59:35


```cpp #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<algorithm> using namespace std; int a[10005], j[10005]; int statistics(int a[], int b){ int al = a[0], ans = 0; for(int i = 1;i <= al;i++){ if(a[i] == b){ ans++; } } return ans; } void mulBIG(int a[], int b){ int bl = a[0]; int u = 0; for(int i = 1; i <= bl; i++){ int t = a[i] * b + u; a[i] = t % 10; u = t / 10; } while(u > 0){ bl++; a[bl] = u % 10; u /= 10; } a[0] = bl; } int main() { int t; scanf("%d", &t); for(int i = 1; i <= t; i++) { char x[100]; int b, cnt; memset(a, 0, sizeof(a)); a[0] = 1; a[1] = 1; scanf("%d%s", &b, &x); for(int i = 2; i <= b; i++){ mulBIG(a, i); } printf("%d\n", statistics(a, x[0]-48)); } return 0; } ```
by songlll @ 2023-09-02 17:56:22


|