Submission

Status:
PPPPPPPPPP

Score: 100

User: Cmoss9

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-03-23 19:17:48

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    ll n;
    ll res = 0, now = 0;
    cin >> n;
    for (ll i = n;i>=(n % 2 == 0 ? 2 : 1); i-=2) {
        if (i<=2) {
            if (i == 2) {
                res += (now + 3) %10;
                res += (now+4) % 10;
            } else res+= (now+1) % 10;
        } else {
            now += (i*3) - 2;
            res+= now%10 + (now + 1) %10;
            now += i-2;
        }
    }
    cout << res;
}