Skip to content

Commit

Permalink
Add 25592.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiyabye committed Jun 15, 2024
1 parent d780f22 commit 68f0ef4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions 25xxx/25592.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <iostream>
using namespace std;

void solve(void) {
int n; cin >> n;

for (int i=1; ; i++) {
if (n >= i*(i+1)/2) continue;
cout << (i & 1 ? i*(i+1)/2-n : 0);
return;
}
}

int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);

solve();
return 0;
}

0 comments on commit 68f0ef4

Please sign in to comment.