为什么全wwwwwaaaaaaaaa

P1015 [NOIP1999 普及组] 回文数

AK360 @ 2024-08-11 20:07:33


by syex_luoyukai @ 2024-08-11 20:08:34

代码

@AK360


by Greeper @ 2024-08-11 20:09:04

@AK360 代码呢?


by AK360 @ 2024-08-11 20:18:10

@syex_luoyukai 怎么复制带吗显示格式不对


by AK360 @ 2024-08-11 20:18:46

@Greeper 复制不了代码


by Greeper @ 2024-08-11 20:20:40

@AK360 o


by syex_luoyukai @ 2024-08-11 20:23:00

全选代码再Ctrl+C移到发出网页再Ctrl+V


by AK360 @ 2024-08-11 20:26:23

它说为按排板要求,不让我题交


by AK360 @ 2024-08-11 20:27:05

@syex_luoyukai 它说我没按排板要求,不让我题交


by syex_luoyukai @ 2024-08-11 20:30:44

代码前+```cpp代码后+``````


by AK360 @ 2024-08-11 20:30:45

#include<bits/stdc++.h>
using namespace std;
bool h(int n)
{
    if(n<=9)
    {
        return 1;
    }
    int y=0;
    int x=n;
    while(x>0)
    {
        y=y*10+x%10;
        x=x/10;
    } 
    if(y==n)
    {
        return 1;
    }
    return 0; 
}
long long q(int n)
{
    if(n<=9)
    {
        return n;
    }
    int x=n,y=0;
    while(x>0)
    {
        y=y*10+x%10; 
        x/=10;
    }
    return y; 
} 
int main ()
{
    int m,n=0;
    string s;
    cin>>m;
    if(m==10)
    {
        cin>>n; 
    } 
    else if(m==2)
    {
        cin>>s;
        for(int i=0;i<s.size();i++)
        {
            n=n+s[i]*pow(2,i);
        }
    } 
//  if(h(n))
//  {
//      cout<<n;
//  }
    int d=0; 
    while(d<=30)
    {
        d++;
        n+=q(n);
        if(h(n))
        {
            cout<<"STEP="<<d;
            return 0;
        }
    }
    cout<<"Impossible!";
    return 0;
}

| 下一页