#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
const int MOD = 1e9+7;
const int MAX_N = 44721;
int K;
int tri[MAX_N+1];
int cnt[MAX_N+1];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> K;
if (K == 0) {
cout << 0 << "\n";
return 0;
}
for (int i = 1; i <= MAX_N; i++) {
tri[i] = i*(i+1)/2;
}
int N = 1;
for (int i = MAX_N; i >= 1; i--) {
cnt[i] = K / tri[i];
N += i*cnt[i];
K %= tri[i];
}
cout << N << "\n";
cout << 0 << " " << -1 << "\n";
int curVal = 0;
for (int i = 1; i <= MAX_N; i++) {
for (int j = 1; j <= cnt[i]; j++) {
for (int k = 1; k <= i; k++) {
curVal++;
if (k == 1) {
cout << curVal << " " << 0 << "\n";
continue;
}
cout << curVal << " " << curVal-1 << "\n";
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
464 KB |
Integer parameter [name=N] equals to 0, violates the range [1, 1000000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
464 KB |
Integer parameter [name=N] equals to 0, violates the range [1, 1000000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
464 KB |
Integer parameter [name=N] equals to 0, violates the range [1, 1000000] |
2 |
Halted |
0 ms |
0 KB |
- |