Loading...
Submission
# When Author Problem Language CPU Memory
7784 2023-04-12 08:42:40 Dr_KeK Square Reconstruction C++ 17 4 ms 3520 kb Wrong Answer - 2
Test Cases
# CPU Memory Points
1 4 ms 3520 kb 1 Accepted
2 3 ms 3520 kb 0 Wrong Answer
3 0 ms 0 kb 0 Skipped
4 0 ms 0 kb 0 Skipped
5 0 ms 0 kb 0 Skipped
6 0 ms 0 kb 0 Skipped
7 0 ms 0 kb 0 Skipped
8 0 ms 0 kb 0 Skipped
9 0 ms 0 kb 0 Skipped
10 0 ms 0 kb 0 Skipped
Source Code
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long int
  4. #define endl "\n"
  5. #define pb push_back
  6. #define ppb pop_back
  7. #define NOO printf("NO\n")
  8. #define YESS printf("YES\n")
  9. #define mp make_pair
  10. #define all(x) (x).begin(), (x).end()
  11.  
  12.  
  13.  
  14. int read() {
  15. int s = 1, x = 0;
  16. char c = getchar();
  17. while (!isdigit(c)) {
  18. if (c == '-')
  19. s = -1;
  20. c = getchar();
  21. }
  22. while (isdigit(c))
  23. x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  24. return s * x;
  25. }
  26.  
  27.  
  28. int main()
  29. {
  30. ios_base::sync_with_stdio(false);
  31. cin.tie(NULL);cout.tie(NULL);
  32.  
  33. ll t=read();
  34. while(t--){
  35.  
  36. ll n=read();
  37. if(sqrt(n)*sqrt(n)==(int)n){
  38. cout<<1<<endl;
  39. continue;
  40. }
  41. for(ll i=1;i<=n;i++){
  42. if(ceil(sqrt(n*i)) == floor(sqrt(n*i))){
  43. cout<<i<<endl;
  44. break;
  45. }
  46. }
  47. }
  48. }