1 solutions
-
0
C++ :
#include <iostream> using namespace std; int main() { int n; cin >> n; // 提取百位、十位和个位数字 int hundred = n / 100; // 百位 int ten = (n / 10) % 10; // 十位 int unit = n % 10; // 个位 // 转换规则:1 -> 9,9 -> 1 hundred = (hundred == 1) ? 9 : 1; ten = (ten == 1) ? 9 : 1; unit = (unit == 1) ? 9 : 1; // 组合成新的三位数 int result = hundred * 100 + ten * 10 + unit; // 输出结果 cout << result << endl; return 0; }
- 1
Information
- ID
- 697
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 10
- Tags
- # Submissions
- 1
- Accepted
- 1
- Uploaded By