Submission
Status:
[PPPPPPPPP]
Score: 100
User: Nathlol2
Problemset: ขนมของเซ้น143 (v.ง่าย)
Language: cpp
Time: 0.003 second
Submitted On: 2025-01-10 11:26:26
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll sum(ll n){
return (n * (n + 1)) / 2;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
ll ans = INT_MAX;
for(int i = 1;i<=n;i++){
ans = min(ans, abs(sum(i) - (sum(n) - sum(i))));
}
cout << ans;
}