题解,求关注
2024-07-10 18:24:37
发布于:浙江
3阅读
0回复
0点赞
#include <iostream>
using namespace std;
int fun(int n, int x)
{
int len = 0, j;
int a[35];
while (n)
{
a[len++] = n % x;
n /= x;
}
for (j = 0; j < len / 2; j++)
{
if (a[j] == a[len - 1 - j])
continue;
else
return 0;
}
return 1;
}
int main()
{
int f, k = 0, s;
cin >> f >> s;
while (k < f)
{
int m = 0;
s += 1;
for (int i = 2; i <= 10; i++)
{
if (fun(s, i))
{
m++;
}
}
if (m >= 2)
{
cout << s << endl;
k++;
}
}
return 0;
}
这里空空如也
有帮助,赞一个