#include<cstdio>
#include<cstdlib>
using namespace std;
bool rnd(int *arr,int len)
{
    for(int i=0;i<=(len>>1);i++)
        if(arr[i]!=arr[len-i])return false;
    return true;
}
bool eva(int *arr,int n)
{
    int tot=0;
    for(int k=2;k<=10;k++){
        int len=0,p=n;
        while(p){
            arr[len]=p%k;
            p/=k;
            len++;
        }
        if(rnd(arr,len-1))tot++;
        if(tot>=2)return true;
    }
    return false;
}
int main()
{
    int n,arr[101];
    while(~scanf("%d",&n)){
        for(++n;!eva(arr,n);n++);
        printf("%d\n",n);
    }
    return 0;
}



总结:调试程序时要关注循环、函数中的变量,看语句改变变量对下一步的影响

    其中,可以写一个judgement.cpp来检验函数的正确性

 

相关文章:

  • 2021-12-23
  • 2022-02-16
  • 2021-09-30
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2021-07-14
  • 2021-10-26
猜你喜欢
  • 2021-05-16
  • 2021-07-13
  • 2021-12-21
  • 2022-02-08
  • 2021-12-04
  • 2021-05-30
  • 2022-12-23
相关资源
相似解决方案