Task: | Neliöt |
Sender: | Gomhog |
Submission time: | 2020-11-06 18:58:36 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 28 |
#2 | ACCEPTED | 72 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2 | details |
#2 | ACCEPTED | 0.01 s | 1, 2 | details |
#3 | ACCEPTED | 0.01 s | 2 | details |
Code
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; #define F first #define S second using namespace std; void solve(int n) { for (int k=2;k*k<=n;k++) { if (n%k!=0) continue; if (k%4==3) { int kk=k*k; while (n%kk==0) n/=kk; if (n%k==0) { cout<<"NO\n"; return; } } while (n%k==0) n/=k; } if (n%4==3) cout<<"NO\n"; else cout<<"YES\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int tst; cin>>tst; for (int t=0;t<tst;t++) { int n; cin>>n; solve(n); } }
Test details
Test 1
Group: 1, 2
Verdict: ACCEPTED
input |
---|
100 1 2 3 4 ... |
correct output |
---|
YES YES NO YES YES ... |
user output |
---|
YES YES NO YES YES ... Truncated |
Test 2
Group: 1, 2
Verdict: ACCEPTED
input |
---|
100 522 419 402 969 ... |
correct output |
---|
YES NO NO NO NO ... |
user output |
---|
YES NO NO NO NO ... Truncated |
Test 3
Group: 2
Verdict: ACCEPTED
input |
---|
100 575833539 744851460 436154655 655319365 ... |
correct output |
---|
NO NO NO NO NO ... |
user output |
---|
NO NO NO NO NO ... Truncated |