Advertisement
a53

PatratMagic4

a53
Sep 14th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. long int c,n=0;
  7. cin>>c;
  8. do
  9. ++n;
  10. while(((n*n+1)*n)/2!=c&&n<c);
  11. if((n*n+1)*n/2==c)
  12. cout<<n;
  13. else
  14. cout<<0;
  15. return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement