Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int kk = 0, mins = 1, ctt = 0, n;
- cin >> n;
- while(true)
- {
- if(n<=0){break;}
- n=(n-mins);
- ctt++;
- if(kk == 1){kk = 0;mins++;}
- else if(kk == 0){kk = 1;}
- if( (n-mins)<0 ){break;}
- }
- cout << n << " " << ctt;
- return 0;
- }
Add Comment
Please, Sign In to add comment