fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. bool sc(long double x)
  5. {
  6. if (x >= 0) {
  7. long long cr = cbrt(x);
  8. return (cr*cr*cr == x);
  9. }
  10. return false;
  11. }
  12.  
  13. bool sq(long double x)
  14. {
  15. if (x >= 0) {
  16. long long sr = sqrt(x);
  17. return (sr * sr == x);
  18. }
  19. return false;
  20. }
  21.  
  22. int main() {
  23. // your code goes here
  24. unordered_set<int>s;
  25. for(long long i=1;i<1e8;i++)
  26. {
  27. if (sq(i))
  28. if (sc(i))
  29. s.insert(i);
  30. }
  31. long long n;
  32. cin>>n;
  33. while(n!=0)
  34. {
  35. auto pos=s.find(n);
  36. if (pos==s.end())
  37. cout<<"Ordinary\n";
  38. else
  39. cout<<"Special\n";
  40. cin>>n;
  41. }
  42. return 0;
  43. }
Success #stdin #stdout 0.51s 5208KB
stdin
729
0
stdout
Special