传送门
思路:
题目中给出的矩阵均为16进制表示,根据规律输出对应10进制数即可。
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int inf = 0x3f3f3f3f;
int main()
{
ll n;
cin>>n;
ll x,y;
cin>>x>>y;
if(x+y < n)
{
cout<<(y+1)*y/2+(y+2+x+1+y)*x/2<<endl;
}
else
{
ll ans = (y+1)*y/2+(y+2+(n-y-1)+1+y)*(n-y-1)/2;
ans += (n+n-(x+y-n+1)+1)*(x+y-n+1)/2;
cout<<ans<<endl;
}
}