这是代码
#include<bits/stdc++.h>
using namespace std;
long long n,i,j,x,y,l,r,s,tot;
int main()
{
cin>>n>>i>>j;
x=n;
y=1;
l=i;
r=j;
while (x!=0&&y!=0)
{
if (i==y)
{
cout<<r+s;
return 0;
}
if (i==x)
{
cout<<3*n-r-1+s;
return 0;
}
if (j==y)
{
cout<<3*n+l-3+s;
return 0;
}
if (j==x)
{
cout<<n+l-1+s;
return 0;
}
s=s+4*n-4;
x-=1;
y+=1;
n-=2;
l++;
r--;
}
return 0;
}
不知是哪里错了