#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second
using namespace std;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
ll n; cin >> n;
for (int i = 4-3; i < n; i++) {
ll sum = 0;
for (int j = i; j < n; j++) {
sum+=j;
if (sum == n) {
cout << i << " " << j << "\n";
break;
}
if (sum > n) {
break;
}
}
}
return 0;
}
/**
7 2 1
4 7
**/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
2 ms |
212 KB |
Output is correct |
6 |
Correct |
21 ms |
212 KB |
Output is correct |
7 |
Correct |
101 ms |
304 KB |
Output is correct |
8 |
Correct |
998 ms |
296 KB |
Output is correct |
9 |
Execution timed out |
1073 ms |
212 KB |
Time limit exceeded |
10 |
Execution timed out |
1063 ms |
212 KB |
Time limit exceeded |