fork(6) download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5. typedef unsigned long long int ullong;
  6.  
  7. bool testSqure1(ullong x) {
  8. double a = sqrt(x);
  9. return (int)a == a;
  10. }
  11.  
  12. bool testSqure2(ullong x) {
  13. ullong a = sqrt(x);
  14. return a*a==x;
  15. }
  16.  
  17.  
  18. int main() {
  19. ullong x;
  20. while (cin >> x) {
  21. cout << x << " " << x*x << " " << testSqure1(x*x) << " " << testSqure2(x*x) << endl;
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0s 3144KB
stdin
4
10000
10234
4294967296
4294967290
4294967294
2147483648
2147483647
268435456
268435458
268435450
268435455
134217728
134217729
134217733
stdout
4 16 1 1
10000 100000000 1 1
10234 104734756 1 1
4294967296 0 1 1
4294967290 18446744022169944100 0 0
4294967294 18446744056529682436 0 0
2147483648 4611686018427387904 0 1
2147483647 4611686014132420609 0 0
268435456 72057594037927936 1 1
268435458 72057595111669764 0 0
268435450 72057590816702500 0 0
268435455 72057593501057025 0 0
134217728 18014398509481984 1 1
134217729 18014398777917441 0 0
134217733 18014399851659289 0 0