You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
533 B
30 lines
533 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
int n;
|
|
const int N = 15;
|
|
int b[N], idx;
|
|
|
|
int main() {
|
|
cin >> n;
|
|
//特判
|
|
if (n == 0) {
|
|
printf("0");
|
|
exit(0);
|
|
}
|
|
//如果是负数,输出负号
|
|
if (n < 0) n = -n, printf("-");
|
|
//数位分离
|
|
while (n) {
|
|
int a = n % 10;
|
|
n /= 10;
|
|
b[idx++] = a;
|
|
}
|
|
//下标
|
|
int i = 0;
|
|
//去掉前导0
|
|
while (!b[i]) i++;
|
|
//输出
|
|
for (; i < idx; i++)cout << b[i];
|
|
return 0;
|
|
} |