题解
2025-05-07 18:59:03
发布于:四川
2阅读
0回复
0点赞
因打字过快有错请纠正,打在评论区,多多点赞哦!
#include<bits/stdc++.h>
using namespace std;
int main() {
string s;
int st;
cin >> s >> st;
string a = "";
for (int i = 0; i < s.size(); i++) {
int t = s[i] - 'A' + st;
string b = "";
while (t != 0) {
b += t % 10 + '0';
t /= 10;
}
for (int i = b.size() - 1; i >= 0; i--)
a += b[i];
}
while (a.size() > 2 && a != "100") {
string t = "";
for (int i = 0; i < a.size() - 1; i++){
int n = (a[i] - '0' + a[i+1] - '0') % 10;
t += char(n + '0');
}
a = t;
}
while (a[0] == '0') a.erase(0, 1);
cout << a;
return 0;
}
全部评论 1
啊没有错
2025-05-07 来自 四川
0
有帮助,赞一个