Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: mightbeputter

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-03-28 14:51:56

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    int n;
    cin >> n;
    int now = 0, ans = 0;
    while(n > 0){
        if(n == 1) ans += (now+1)%10, n = 0;
        else if(n == 2) ans += (now+3)%10+(now+4)%10, n=0;
        if(n == 0) break;
        ans += (now+n*2+n-2)%10*2+1;
        if((now+n*2+n-2)%10 == 9) ans -= 10;
        // cout << ans << "\n";
        now = (now+n*2+n-2+n-2)%10;
        n-=2;
    }
    cout << ans;
    return 0;
}