Submission
Id | When | Author | Problem | Language | CPU | Memory | Verdict |
---|---|---|---|---|---|---|---|
16969 | 2024-04-23 17:05:51 | ewu_intra24_mock_u_187 | Binary Prime | C++ 17 | 1 ms | 3408 kb | Accepted |
Test Cases
CPU | Memory | Verdict | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 ms | 3340 kb | Accepted | ||||||||
2 | 1 ms | 3340 kb | Accepted | ||||||||
3 | 1 ms | 3360 kb | Accepted | ||||||||
4 | 1 ms | 3364 kb | Accepted | ||||||||
5 | 1 ms | 3328 kb | Accepted | ||||||||
6 | 1 ms | 3352 kb | Accepted | ||||||||
7 | 1 ms | 3368 kb | Accepted | ||||||||
8 | 1 ms | 3408 kb | Accepted | ||||||||
9 | 1 ms | 3384 kb | Accepted | ||||||||
10 | 1 ms | 3372 kb | Accepted | ||||||||
11 | 1 ms | 3376 kb | Accepted | ||||||||
Source Code
program.cpp
#include<bits/stdc++.h> using namespace std; #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define all(a) (a).begin(),(a).end() #define nl cout<<'\n' ; #define dbg(x) cerr<<"Line no- "<<__LINE__<<": "<<#x<<" = "<<x<<'\n'; #define out(a) cout<<a<<'\n'; #define hmm(ok) cout<<(ok==1?"YES":"NO")<<'\n'; #define ld long double #define ll long long #define ull unsigned long long const ld PI = 3.141592653589793238462; const ll MOD = 1e9+7; const ll INF = 1e18; bool is_prime(int n) { for(int i=2; i*i<=n; i++) { if(n%i==0) { return false; } } return true; } void solve() { ll n; cin>>n; int cnt=0; while(n>0) { cnt+=n%2; n/=2; } if(is_prime(cnt) and cnt!=1){ out("Binary prime") } else{ out(-1) } } int main() { faster; int test; cin>>test; int i=1; while(test--){ solve(); //cout<<"Case "<<i++<<":"; } }