Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define INF 0x3f3f3f3f
- #define NMAX 50005
- using namespace std;
- ifstream fin("fisier.in");
- ofstream fout("fisier.out");
- int main() {
- int n,i,curr,start=2,j;
- long long gauss,e;
- fin>>n>>e;
- for(i=2,curr=0;i<=n+1;++i) {
- if(1LL*(curr+1)*(curr+2)/2+n-i<=e)
- ++curr;
- else {
- e-=1LL*curr*(curr+1)/2;
- curr=0;
- for(j=i-1;j>start;--j) fout << j << ' ' << j-1<<'\n';
- fout << start << " 1\n";
- start = i;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement