1 条题解
-
0Infinity_ LV 8 @ 2024-08-30 17:05:10
#include<iostream> #include<string> #include<cmath> using namespace std; string s0, s1, s2; long long add(string s, string t){ int len1 = s.size(), len2 = t.size(); long long result = 0; for(int i = 0; i < len1; i++)result += (s[i]-'0') * pow(10, len1-i-1); for(int i = 0; i < len2; i++)result += (t[i]-'0') * pow(10, len2-i-1); return result; } int main(){ ios::sync_with_stdio(false); getline(cin, s0); int len = s0.size(), Max = 0; for(int i = 1; i < len; i++){ s1 = s0.substr(0, i); s2 = s0.substr(i, len-i); int x = add(s1, s2); cout << s1 << '+' << s2 << '=' << x << endl; if(x > Max)Max = x; } cout << "summax is:" << Max; return 0; }
- 1
信息
- 难度
- 8
- 分类
- (无)
- 标签
- 递交数
- 13
- 已通过
- 6
- 通过率
- 46%
- 被复制
- 6
- 上传者