80 分 3 / 6 wa
查看原帖
80 分 3 / 6 wa
1400000
Lordi楼主2024/8/28 10:09

帮帮忙

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz sizeof
#define sl strlen
#define gl getline
#define ss substr
#define sc strcat
#define scm strcmp
const int maxN = 2E2+10;
int L, i;
char s[maxN], t[maxN];
signed main(){
	scanf("%s", s);
	L = sl(s); -- L;
	while(s[i ++] == '9'){
		if(i == L){
			for(int i = 0; i <= L; ++ i){
				s[i] = '0';
			}
			break;
		}
	} for(i = 0; i <= L - i; ++ i){
		t[i] = s[i];
		t[L - i] = s[i];
	} if(scm(t, s) < 1){
		while(t[-- i] == '9'){
			"I AK IOI";
		}
		t[i] ++;
		t[L - i] = t[i];
		for(i ++; i <= L - i; ++ i){
			t[i] = '0';
			t[L - i] = '0'; 
		}
	}
	cout << t;
	return 0;
}

感谢

2024/8/28 10:09
加载中...