链接
题目描述
样例输入#1
123
样例输出#1
321
样例输入#2
-830
样例输出#2
-38
思路
直接读入然后判断一下,倒着输出就好了,毕竟
代码
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int t, b;
char c[100005];
int main()
{
c[++t] = getchar();
if(c[t] == '-') b = 1, c[t] = getchar();
while(c[t] != '\n') c[++t] = getchar();
t--;
while(c[t] == '0') t--;
if(b) printf("-");
for(int i = t; i >= 1; --i)
printf("%c", c[i]);
return 0;
}