40分但Subtask#1AC
查看原帖
40分但Subtask#1AC
1386327
zhuyifan0826楼主2025/1/8 17:08
#include <bits/stdc++.h>
using namespace std;
void f(long long a) {
    long i = 0;
    long long b = a, c = a;
    while (b > 0) {
        b /= 10;
        i++;
    }
    int x[i], j = 0;
    while (a > 0) {
        x[j] = a % 10;
        a /= 10;
        j++;
    }
	if (c < 0) cout << '-';
    for (int l = 0; l < i; l++) {
    	if (x[l] == 0 && l == 0) continue;
		else cout << x[l];
	}
    
    return ;
    
}
int main() {
    long long a;
    cin >> a;
    if (a == 0) {
        cout << 0;
        return 0;
    }
    f(a);
    return 0;
}
2025/1/8 17:08
加载中...