Advertisement
CloneTrooper1019

UVa 10110 - Light, More Light

Nov 27th, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #ifdef _MSC_VER
  2. #define _CRT_SECURE_NO_WARNINGS 1
  3. #endif
  4.  
  5. #include <iostream>
  6. #include <cmath>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.     unsigned int n; // unsigned since n <= (2^32)-1
  13.  
  14.     while (scanf("%d", &n) != EOF)
  15.     {
  16.         if (n == 0) break;
  17.  
  18.         unsigned int root = sqrt(n);
  19.  
  20.         if (root*root == n) // Is it a perfect square?
  21.             cout << "yes\n";
  22.         else
  23.             cout << "no\n";
  24.     }
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement