Submission

Status:

----------

Subtask/Task Score:

0/100

Score: 0

User: exoworldgd

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-11-08 15:55:36

#pragma GCC optimize("O5,unroll-loops,inline")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
#define exoworldgd cin.tie(0)->sync_with_stdio(0), cout.tie(0)
#define int long long
using namespace std;
const int inf = LLONG_MAX, mod = 1e9+7, maxn = 2e7+5;
signed main(void) {
	exoworldgd;
	int n;
	cin >> n;
	int j=n,sum=0,t=3*n-1,add;
	for (int i =0; i< n ;i ++) {
		if (n== 1) {sum =1; break;}
		else if (n == i-1) t += (n&1 ? 1 : -1);
		else if (i&1) t++;
		else t += add;
		add = j*4-7, j--, sum = t%10;
	}
	cout << sum;
}