fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios_base::sync_with_stdio(false);
  6. cin.tie(0);
  7. cout.tie(0);
  8. int t,c=0;
  9. cin>>t;
  10. while(t--)
  11. {
  12. int x;
  13. long long y=0;
  14. cin>>x;
  15. for(int i=1;i<x;i++)
  16. {
  17. cout<<i<<" "<<y<<"\n";
  18. if(y==x)
  19. break;
  20. y+=i;
  21. c++;
  22. }
  23. }
  24. cout<<c;
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5516KB
stdin
3
6
10
2

stdout
1 0
2 1
3 3
4 6
1 0
2 1
3 3
4 6
5 10
1 0
8