0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-05 10:58:47 +00:00
OI-codes/Luogu/P1147/P1147.cpp
2022-02-12 10:08:28 +08:00

24 lines
408 B
C++

#include <iostream>
using std::cin;
using std::cout;
#define endl '\n'
int m, sum, j;
int main() {
std::ios::sync_with_stdio(false);
cin >> m;
for (int i = 1; i <= m / 2; i++) {
sum = 0;
for (j = i; j < m; j++) {
sum += j;
if (sum >= m) break;
}
if (sum == m) {
cout << i << ' ' << j << endl;
}
}
return 0;
}