Submission

Status:

PPP-PPP-PP

Subtask/Task Score:

80/100

Score: 80

User: lazybw_

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-07-06 13:06:17

#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*2-1)%10);
    cout<<s;
    return 0;
}