最抽象的一集
2024-04-13 17:07:54
发布于:广东
33阅读
0回复
0点赞
#include <iostream>
#include <cstdio>
using namespace std;
long long a, b, c, d, e, f, g, h, A, B, C, D, E, F, G, H;
const long long jinwei = 1e9;
int main(){
int n;
cin >> n;
while(n){
A = 0, B = 0, C = 0, D = 0, E = 0, F = 0, G = 0, H = 1;
for(int X = 2; X <= n; X++){
A *= X, B *= X, C *= X, D *= X, E *= X, F *= X, G *= X, H *= X;
int x = H / jinwei;
H %= jinwei;
G += x;
x = G / jinwei;
G %= jinwei;
F += x;
x = F / jinwei;
F %= jinwei;
E += x;
x = E / jinwei;
E %= jinwei;
D += x;
x = D / jinwei;
D %= jinwei;
C += x;
x = C / jinwei;
C %= jinwei;
B += x;
x = B / jinwei;
B %= jinwei;
A += x;
//cout << A << endl;
}
a += A, b += B, c += C, d += D, e += E, f += F, g += G, h += H;
int x = h / jinwei;
h %= jinwei;
g += x;
x = g / jinwei;
g %= jinwei;
f += x;
x = f / jinwei;
f %= jinwei;
e += x;
x = e / jinwei;
e %= jinwei;
d += x;
x = d / jinwei;
d %= jinwei;
c += x;
x = c / jinwei;
c %= jinwei;
b += x;
x = b / jinwei;
b %= jinwei;
a += x;
n--;
}
if(a){
cout << a;
printf("%09d%09d%09d%09d%09d%09d%09d", b, c, d, e, f, g, h);
return 0;
}if(b){
cout << b;
printf("%09d%09d%09d%09d%09d%09d", c, d, e, f, g, h);
return 0;
}
if(c){
cout << c;
printf("%09d%09d%09d%09d%09d", d, e, f, g, h);
return 0;
}if(d){
cout << d;
printf("%09d%09d%09d%09d", e, f, g, h);
return 0;
}if(e){
cout << e;
printf("%09d%09d%09d", f, g, h);
return 0;
}if(f){
cout << f;
printf("%09d%09d", g, h);
return 0;
}if(g){
cout << g;
printf("%09d", h);
return 0;
}cout << h;
return 0;
}
全部评论 2
卡着第4514条讨论发的(
2024-04-13 来自 广东
0你就说是不是高精度吧(
2024-04-13 来自 广东
0
有帮助,赞一个