题解:P15050 [UOI 2023 II Stage] Pixel snail
第一个步涂了一个边长为
第二步涂了一个格子。
第三步涂了一个边长为
把上面的答案加起来即可。
代码
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
inline int read(){
int x=0,f=1;char ch=getchar();
for(;ch>'9'||ch<'0';ch=getchar())if(ch=='-')f=-1;
for(;ch>='0'&&ch<='9';ch=getchar())x=(x<<1)+(x<<3)+(ch^48);
return x*f;
}
signed main(){
n=read();
if(n==1)cout<<11,exit(0);
cout<<(n+2)*4-3+1+n*4-4;
return 0;
}