Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: lazybw_

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-07-06 13:15:20

#include <bits/stdc++.h>

using namespace std;
using ll = int32_t;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    ll n; cin>>n;
    ll carry = 0, s = 0;
    for (ll u = n; u > 2; u-=2) s += (3*u-1+carry)%10 + (3*u-2+carry)%10, carry = (carry+4*(u-1))%10;
    n %= 10;
    s += (n & 1) ? (n*n)%10 : (n == 0 ? 9 : (n*n-1)%10+(n*n)%10);
    cout<<s;
    return 0;
}