rengetsu

KVALIF_VGTU_B

Mar 17th, 2020
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int kk = 0, mins = 1, ctt = 0, n;
  6.     cin >> n;
  7.     while(true)
  8.     {
  9.         if(n<=0){break;}
  10.         n=(n-mins);
  11.         ctt++;
  12.         if(kk == 1){kk = 0;mins++;}
  13.         else if(kk == 0){kk = 1;}
  14.         if( (n-mins)<0 ){break;}
  15.     }
  16.     cout << n << " " << ctt;
  17.     return 0;
  18. }
Add Comment
Please, Sign In to add comment