版本比较
2.1 总体复盘 / My 高精度板子.
正文
增加 16 行删除 16 行
93 行未改动94959697989910098991001011021021031041051051061071081091081091101111121135 行未改动1191201211221231231241251261271281281291301311301311321331341341351361371361371381391391401411421431431441451461472 行未改动93 行未改动 for (; ans.a[ans.len - 1] == 0 && ans.len > 1; ans.len--); return ans; } friend const BigInt operator/(const BigInt &a, const BigInt &b) { BigInt sum; BigInt ans = 0; ans.len = a.len; BigInt sum; BigInt ans = 0; ans.len = a.len; for(int i = a.len - 1; i >= 0; i--) { sum = sum * 10 + a.a[i]; sum = sum * 10 + a.a[i]; while(comp(sum, b) != -1) { sum = sum - b; ans.a[i]++; ans.a[i]++; } } for (; ans.a[ans.len - 1] == 0 && ans.len > 1; ans.len--); return ans; for (; ans.a[ans.len - 1] == 0 && ans.len > 1; ans.len--); return ans; } friend std::istream& operator>>(std::istream& is, BigInt &a) { std::string s; is >> s;5 行未改动 return os; }};```#### T4 #### T4
在高精度板子的基础上直接写就行了:
```cppBigInt res, sum = 1; BigInt res, sum = 1;void solve() { int n; std::cin >> n; int n; std::cin >> n; for (BigInt i = 1; i <= n; i = i + 1) { for (BigInt j = 1; j <= i; j = j + 1) { sum = sum * j; sum = sum * j; } res = res + sum; sum = 1; res = res + sum; sum = 1; } std::cout << res << std::endl; std::cout << res << std::endl;}```
#### T5 #### T5
熟悉的题目。 先把输赢情况给打表打出来,然后进行周期性循环即可。
---2 行未改动