Submission

Status:
PPPPPPPPPP

Score: 100

User: Angonnyyy

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-03-17 09:40:35

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

int main(){
    int n;
    int temp,total=0,r=0;
    cin>>n;
    while(n){
        if(n==1){
            total+=(r+1)%10;
            break;
        }
        else if (n==2){
            total+=(r+3)%10 + (r+4)%10;
            break;
        }

        temp=(((3*n)-2+r)%10);
        total+=temp;
        temp++;
        temp%=10;
        r=(temp+n-3);
        r%=10;
        total+=temp;
        n-=2;
        //cout << total << "/" << r << "-";
    }
    cout << total;
}