/* * test.cpp * * Created on: Dec 15, 2010 * Author: alfred */ #include <iostream> #include <string> using namespace std; bool judge(int b) { string a; int count = 0; for(int i = 2; i <= 10; i++) { int m = b; a.clear(); while(m != 0) { a += (m % i); m /= i; } int x = 0, y = a.size() - 1; bool ok = true; for(; x < y;) { if(a[x++] != a[y--]) { ok = false; break; } } if(ok && (++count == 2)) { return true; } } return false; } int main() { int S; while(cin >> S) { for(int i = S + 1; ; i++) { if(judge(i)) { cout << i << endl; break; } } } return 0; }
双基回文数
最新推荐文章于 2024-07-01 17:15:31 发布
1882

被折叠的 条评论
为什么被折叠?



