Submission

Status:

[PPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: tankunkid

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-24 20:08:20

#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;
    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;
}