Submission

Status:

[PPPP-SSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: tankunkid

Problemset: ขนมของเซ้น143 (v.ง่าย)

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-24 20:03:44

#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 = 2e9;
    while (true) {
        sumf = 1LL * ((crrp)*(crrp-1))/2;
        sumb = 1LL * ((crrp+n)*(n-crrp+1))/2;
        lows = min(lows, abs(sumf - sumb));
        if (crrp == 0) {break;}
        crrp--;
    }
    cout << lows;
}