fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n,k;
  4. int main(){
  5. cin>>n;
  6. k=trunc(sqrt(2*n));
  7. if(2*n==k*(k+1)) cout<<k;
  8. else cout<<"khong";
  9. }
Success #stdin #stdout 0.01s 5280KB
stdin
10
stdout
4