Submission

Status:
PPPPPP----

Score: 60

User: yumiKuri

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-03-23 12:21:56

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

int main(){
    ios_base::sync_with_stdio(0), cin.tie(0);

    int n;
    cin >> n;
    int sum = 0;
    int start = 0;

    while(true){
        if(n <= 2){
            if(n == 2){
                sum += (start+3)%10;
                sum += (start+4)%10;
            }
            else{
               sum += (start+1)%10;
            }
            break;
        }

        start += n*2 + (n-2);
        sum += start%10 + (start+1)%10;
        start += n-2;
        n -= 2;
    }

    cout << sum;
}