Illustriousex @ 2020-09-08 22:07:03
#include<iostream>
#include<cstring>
using namespace std;
int main (){
char a[100];
char c[100];
memset(a,'a',sizeof(a));
cin >> a;
int b = 0;
int d = 0;
int e = 0;
for (int i = 0; i < 100; i ++) if (a[i] != 'a') b ++;
if (a[0] != '-') for (int i = b - 1; i >= 0; i --) {
if (a[i] != '0') d = b;
}
else for (int i = b - 1; i > 0; i --) {
if (a[i] != '0') d = b;
}
if (a[0] != '-') for (int i = b; i >= 0; i --) {
c[e] = a[i];
e ++;
}
else for (int i = b; i > 0; i --) {
c[e] = a[i];
e ++;
}
int f;
for (int i = 2; i <= b; i ++) if (c[i] != '0') {
f = i;
break;
}
if (a[0] != '-') for (int i = f; i <= b; i ++) cout << c[i] ;
else {
cout << "-";
for (int i = f; i <= b; i ++) cout << c[i] ;
}
return 0;
}
感觉输出没毛病啊( 我输入-290出来也是-92但是就是过不了( 求解惑(
by ⚡小林子⚡ @ 2020-09-08 22:19:36
我咋看不懂呢 /yiw
直接写个 while 反转它不香吗
by AirCnt @ 2020-09-08 22:29:56
为什么要这么麻烦
by AirCnt @ 2020-09-08 22:30:20
看都看不懂了变成
by AirCnt @ 2020-09-08 22:32:44
@Illustriousex 您改改再来?
by AirCnt @ 2020-09-08 22:41:25
?