39 条题解
-
0
对于一个两位数ab,要实现各位和十位的交换,需要先提取出a和b。
a=x/10;意思是ab里有a个10;
b=x%10;意思是ab=a个10+b。
提取出a和b后在进行组合x=b*10+a,
就是我们的代码啦!
AC代码,放心食用
#include <bits/stdc++.h> using namespace std; int main() { int a, b, x; while (scanf("%d", &x) != EOF) { a = x / 10, b = x % 10; cout << b * 10 + a; } return 0; }
信息
- ID
- 603
- 时间
- 1000ms
- 内存
- 64MiB
- 难度
- 3
- 标签
- 递交数
- 1998
- 已通过
- 1053
- 上传者