A 相反数
这道题就是简单地去做一个数的处理
我们先把n存到另一个数a中,再用a去把n的相反数算出来
上代码
#include <bits/stdc++.h>
using namespace std;
int n;
int main()
{
cin >> n;
int a, t;
t = 0;
a = n;
while(a)
{
t = t * 10 + a % 10;
a /= 10;
}
cout << t + n << endl;
return 0;
}
京公网安备 11010502036488号