Advertisement
Josif_tepe

Untitled

Oct 17th, 2021
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.     int t = 0;
  10.     int sz = 1;
  11.     if(n == 1) {
  12.         cout << "1 1" << endl;
  13.         return 0;
  14.     }
  15.     while(t <= n) {
  16.         t += sz;
  17.         if(t == n - 1) {
  18.             cout << "1 0" << endl;
  19.             return 0;
  20.         }
  21.         if(t == n) {
  22.             cout << "0 1" << endl;
  23.             return 0;
  24.         }
  25.         sz++;
  26.     }
  27.     cout << "0 0" << endl;
  28.     return 0;
  29. }
  30.  
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement