来来来高精度直接上
2024-08-17 21:12:16
发布于:浙江
16阅读
0回复
0点赞
喜爱装好吧,😁
#include <iostream>
#include <string>
#include <vector>
typedef long long Int;
typedef stdvector<Int> Nat;
Nat fromInt(Int x) {
Nat n{};
for (; x; x /= 10)
n.push_back(x % 10);
return n;
}
Nat fromString(stdstring s) {
Nat n{};
for (Int i = (Int)s.size() - 1; i >= 0; i--)
n.push_back(s[i] - '0');
while (n.size() && !n.back())
n.pop_back();
return n;
}
stdstring toString(Nat n) {
if (!n.size())
return "0";
stdstring s = "";
for (Int i = (Int)n.size() - 1; i >= 0; i--) {
s += n[i] + '0';
}
return s;
}
int main() {
stdstring s1;
stdcin>>s1;
Nat n1=fromString(s1);
stdcout<<toString(n1)<<stdendl;}
全部评论 1
就是帅
2024-08-17 来自 浙江
0
有帮助,赞一个