Submission
Status:
[PPPPPPPPPP][PTSSS]
Subtask/Task Score:
{10/10}{0/90}
Score: 10
User: tankunkid
Problemset: ขนมของเซ้น143 (v.ยาก)
Language: cpp
Time: 0.287 second
Submitted On: 2025-10-24 20:10:55
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
int crrp = n;
long long int sumf = 0;
long long int sumb = 0;
string ans = "False";
long long int lows = LLONG_MAX;
for (int crrp = n; crrp >= 1; --crrp) {
long long sumf = 1LL * crrp * (crrp - 1) / 2;
long long sumb = 1LL * (crrp + n) * (n - crrp + 1) / 2;
lows = min(lows, abs(sumf - sumb));
}
cout << lows;
}