Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: erng
Problemset: โชว์ของโลมา
Language: cpp
Time: 0.003 second
Submitted On: 2026-03-11 21:52:36
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n, res;
void solve(ll st, ll dim)
{
if (dim==1)
{
res+=st%10;
return;
}
if (dim==2)
{
res+=(st+2)%10+(st+3)%10;
return;
}
res+=(st+dim*3-2)%10;
res+=(st+dim*3-3)%10;
solve(st+((dim*dim)-(dim-2)*(dim-2)), dim-2);
}
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n;
solve(1, n);
cout<<res;
}