Submission
Status:
PPPPPPPPPP
Score: 100
User: Angonnyyy
Problemset: โชว์ของโลมา
Language: cpp
Time: 0.003 second
Submitted On: 2025-03-17 14:24:54
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false); cin.tie(0);
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;
}