7 条题解
-
4
四种不同结果的题解~
已AC,请放心食用
#include <bits/stdc++.h> using namespace std; int main() { int o, s, x = 1000, n = 0; cin >> o; s = o; while (s > 0) { n += s % 10 * x; s /= 10; x /= 10; } cout << o - n; return 0; }
已WA,请小心食用
#include <bits/stdc++.h> using namespace std; int main() { int o, s, x = 1000, n = 0; cin >> o; s = o; while (s > 0) { n += s % 10 * x; s /= 10; x /= 10; } cout << n - o; return 0; }
已TLE,请小心食用
#include <bits/stdc++.h> using namespace std; int main() { int o, s, x = 1000, n = 0; cin >> o; s = o; while (s > 0) { n += s % 10 * x; n /= 10; x /= 10; } cout << o - n; return 0; }
已RE,请小心食用
#include <bits/stdc++.h> using namespace std; int main() { int o, s, x = 1000, n = 0; cin >> o; s = o; while (s > 0) { n += s % 10 * x; s / 10; x / 10; } cout << o - n; return 0; }
-
3
#include <iostream>//hetao3097453 #include <cmath> using namespace std; int main() { int n,sum = 0,num = 0; cin >> n; int a = n / 1000; int b = n / 100 % 10; int c = n / 10 % 10; int d = n % 10; sum += a * 1 + b * 10 + c * 100 + d * 1000; num = n - sum; cout << num << endl; return 0; }
-
1
字符串
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int a = (s[0] - '0'), b = (s[1] - '0'), c = (s[2] - '0'), d = (s[3] - '0'); int ans1 = a * 1000 + b * 100 + c * 10 + d; int ans2 = d * 1000 + c * 100 + b * 10 + a; cout << ans1 - ans2 << endl; return 0; }
- 1
信息
- ID
- 699
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 4
- 标签
- 递交数
- 268
- 已通过
- 121
- 上传者