Submission

Status:
PPPPPPPPPP

Score: 100

User: hmmm

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-03-13 14:11:39

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

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	long long int n,ans=0,to=0;
	cin >> n;
	int cnt=n;
	while(cnt>2 && to<n*n){
		to+=cnt*2;
//		cout << to << "a\n";				
		to+=cnt-2;
//		cout << to << "b\n";				
		ans+=to%10;
		ans+=(to+1)%10;
//		cout << to << ' ' << (to+1) << ' ' << cnt << "\n";
		to+=cnt-2;
		cnt-=2;
//		cout << to << "c\n";		
//		to++;
		
	}	
	if(n%2==0)  ans+=(n*n)%10+(n*n-1)%10;
	else ans+=(n*n)%10;
	cout << ans;
}