Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: 12345678

Problemset: โชว์ของโลมา

Language: cpp

Time: 0.003 second

Submitted On: 2025-11-09 09:42:34

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int n, res;

void solve(ll st, ll dim)
{
    if (dim==1) return res+=st%10, void();
    if (dim==2) return res+=(st+2)%10+(st+3)%10, void();
    res+=(st+3*dim-3)%10;
    res+=(st+3*dim-2)%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;
}