#include <bits/stdc++.h>
#include <string>
#define ll long long
#define pb push_back
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int maxn=222;
int par[100005];
int k;
int main()
{
IOS
cin>>k;
int cur=0;
while(k>=cur){
k-=cur;
par[cur]=cur-1;
cur++;
}
if(k){
par[cur]=k-1;
cur++;
}
cout<<cur<<endl;
for(int i=0;i<cur;i++){
cout<<i<<' '<<par[i]<<endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
380 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
380 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
5 ms |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
380 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
5 ms |
504 KB |
Output is correct |
11 |
Correct |
26 ms |
508 KB |
Output is correct |
12 |
Correct |
26 ms |
504 KB |
Output is correct |
13 |
Correct |
29 ms |
504 KB |
Output is correct |
14 |
Correct |
25 ms |
504 KB |
Output is correct |
15 |
Correct |
28 ms |
504 KB |
Output is correct |
16 |
Correct |
96 ms |
1016 KB |
Output is correct |
17 |
Correct |
8 ms |
376 KB |
Output is correct |
18 |
Correct |
94 ms |
1016 KB |
Output is correct |
19 |
Correct |
70 ms |
888 KB |
Output is correct |
20 |
Correct |
71 ms |
888 KB |
Output is correct |