解题:
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(){
int x,y;
cin>>x>>y;
if(abs(x)<=y&&y>0){
int n=y;
cout<<(LL)(2*n-1)*(2*n)+x-(-n)<<endl;
}else if(abs(y)<=x&&x>0){
int n=x;
cout<<(LL)(2*n)*(2*n)+n-y<<endl;
}else if(abs(x)<=abs(y)+1&&y<0){
int n=abs(y);
cout<<(LL)(2*n)*(2*n+1)+n-x<<endl;
}else if(abs(y)<abs(x)&&x<0){
int n=abs(x);
cout<<(LL)(2*n-1)*(2*n-1)+y+n-1<<endl;
}
return 0;
}
标签:std,int,long,蓝桥,abs,折线,main,C++
From: https://blog.csdn.net/LH_050902/article/details/145168881