2 条题解
-
0
- 本题目保证答案
- 那么很可能暴力能过,但是需要使用 long long。
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e6+5,P=7; const int inf = 0x3f3f3f3f; bool ish(ll n){ ll t=n, a=0; while(t) a=a*10+t%10, t/=10; return a==n; } int main(){ ll x; cin>>x; for(ll i=x+1; i<=1e10; i++){ if(ish(i)) { cout<<i; break; } } return 0; }
-
0
#include <stdio.h> int huiwen(int a) //回文数的判断函数 { int res = 0; int temp = a; while (a) { res = res * 10 + a % 10; a /= 10; } return res == temp; } int main() { int X = 0; scanf("%d", &X); int num = X + 1; while (1)//一个无限循环,满足条件则跳出 { if (huiwen(num)) { printf("%d", num); break;//满足,跳出while循环,确保输出最小的回文数 } num++; } return 0; }
- 1
信息
- ID
- 63
- 时间
- 1000ms
- 内存
- 64MiB
- 难度
- 8
- 标签
- 递交数
- 117
- 已通过
- 14
- 上传者