Submission

Status:
PPPPPPPPPP

Score: 100

User: mydKN

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-03-23 17:01:38

#include<bits/stdc++.h>

using namespace std;

using ll = long long;

ll n;
ll res, now;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin >> n;
    for(ll i=n;i>=(n % 2 == 0 ? 2 : 1);i-=2){
        if(i <= 2){
            // if(i == 2) res += (now + 7) % 10;
            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;
            // res += (now * 2 + 1) % 10;
            now += i - 2;
        }
    }
    cout << res;
}