saam @ 2024-08-06 20:17:14
#import "bits/stdc++.h"
#define ll long long
using namespace std;
ll sum = 1;
ll jc(ll n){
ll sum=1;
for(int i=2;i<=n;i++)sum*=i;
return sum;
}
signed main(){
ll n,cos=3;
cin >> n;
for(int i=3;i<=n;i++)cos+=jc(i);
cout << cos;
return 0;
}
by saam @ 2024-08-06 20:21:36
本人不会高精度计算?
by ptxy2352010111 @ 2024-08-06 21:50:23
不用高精度过不了,50^50超long long 了
by saam @ 2024-08-06 22:04:47
@ptxy2352010111 高精度是什么?
by GLr137 @ 2024-08-10 17:49:11
……高精度就是高精度,为什么呢?因为高精度是高精度,所以呢高精度是高精度(也就是高精度)。
by GLr137 @ 2024-08-10 17:50:07
之所以高精度是高精度,是因为高精度是高精度,所以代表高精度的高精度本质上还是高精度。
by GLr137 @ 2024-08-10 17:52:15
# include <iostream>
# include <cstring>
using namespace std;
int sz1[1000000] = {0}, sz2[1000000] = {0}, sz3[1500000] = {0}, len, x;
string hs(string s1, string s2){
string s3 = "";
memset(sz1, 0, sizeof(sz1));
memset(sz2, 0, sizeof(sz2));
memset(sz3, 0, sizeof(sz3));
x = 0;
for (int i = s1.size() - 1; i >= 0; i--){
sz1[s1.size() - i - 1] = s1[i] - '0';
}
for (int i = s2.size() - 1; i >= 0; i--){
sz2[s2.size() - i - 1] = s2[i] - '0';
}
if (s1.size() > s2.size()){
len = s1.size();
}else{
len = s2.size();
}
for (int i = 0; i < len; i++){
sz3[i] = (sz1[i] + sz2[i] + x) % 10;
x = (sz1[i] + sz2[i] + x) / 10;
}
if (x == 1){
s3 += x + 48;
}
for (int i = len - 1; i >= 0; i--){
s3 += sz3[i] + 48;
}
return s3;
}
string hs2 (string s1, int s2){
int y = 0;
string s3, s4;
s4 = s1;
for (int i = 1; i <= s2 - 1; i++){
s3 = hs(s1, s4);
s1 = s3;
}
return s1;
}
int main (){
int n, o = 1;
string u = "1", v = "0", w = "0", sz[55] = {"1"};
cin >> n;
for (int i = 1; i <= n; i++){
u = hs2(sz[i - 1], i);
sz[i] = u;
}
for (int i = 1; i <= n; i++){
w = hs(w, sz[i]);
}
cout << w;
return 0;
}
这是高精度“乘”法(本质上是高精度加法,是一层一层累加起来的,也就是高精度乘上单精度。
by GLr137 @ 2024-08-10 17:55:35
求关
by GLr137 @ 2024-08-10 17:56:03
)
by Kete @ 2024-08-19 13:42:16
废话文学
@saam
我的文章里写了高精度
by saam @ 2024-08-22 22:27:56
谢谢