为啥80分
查看原帖
为啥80分
1352810
a_Chana_ball楼主2025/2/3 18:13
#include<bits/stdc++.h>
using namespace std;
long long c=1;
long x,y;
int main()
{
    cin>>x>>y;
    if(x==y)
    {
        cout<<0;
        return 0;
    }
    if(x==-y||x==y-1)
    {
        cout<<1;
        return 0;
    }
    if(x>y)
    {
        x*=-1;
        c=2;
    }
    while(1)
    {
        if(x==-y||x==y-1)
        {
            cout<<c;
            return 0;
        }
        c++;
        x++;
    }
}   
2025/2/3 18:13
加载中...