0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 02:38:49 +00:00
OI-codes/Luogu/P1147/P1147.cpp

24 lines
408 B
C++
Raw Normal View History

2022-02-12 02:08:28 +00:00
#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;
}