This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int k,i=1;
cin>>k;
while(i*(i+1)/2<=k)
i++;
i--;
if(i*(i+1)/2==k)
{
cout<<i+1<<'\n';
cout<<0<<" "<<-1<<'\n';
for(int j=1;j<=i;j++)
cout<<j<<" "<<j-1<<'\n';
}
else
{
cout<<i+2<<'\n';
cout<<0<<" "<<-1<<'\n';
for(int j=1;j<=i;j++)
cout<<j<<" "<<j-1<<'\n';
cout<<i+1<<" "<<k-(i*(i+1)/2)-1;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |