大佬们帮我看看为啥只有60分
查看原帖
大佬们帮我看看为啥只有60分
305941
RayZhu楼主2020/6/5 18:11

只有60分,QAQ
代码如下,求查错,谢谢

#include <iostream>

using namespace std;
bool is_huiwenshu (int n)
{
    int x=n, num=0;
    while (x!=0)
    {
        num=num*10+x%10;
        x/=10;
    }
    if (num==n) return true;
    else return false;
}
int main()
{
    int N, P;
    cin>>N;
    for (P=N+1; ;P++)
    {
        if (is_huiwenshu(P))
        {
            cout<<P<<endl;
            break;
        }
    }
    return 0;
}

2020/6/5 18:11
加载中...