Submission
# | When | Author | Problem | Language | CPU | Memory | |
---|---|---|---|---|---|---|---|
4475 | 2022-03-25 20:10:04 | The_crawler | Binary Prime | C++ 17 | 3 ms | 3516 kb | Accepted |
Test Cases
# | CPU | Memory | Points | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 3 ms | 3516 kb | 1 | Accepted | |||||||
2 | 2 ms | 3408 kb | 1 | Accepted | |||||||
3 | 2 ms | 3496 kb | 1 | Accepted | |||||||
4 | 2 ms | 3412 kb | 1 | Accepted | |||||||
5 | 2 ms | 3380 kb | 1 | Accepted | |||||||
6 | 2 ms | 3416 kb | 1 | Accepted | |||||||
7 | 2 ms | 3500 kb | 1 | Accepted | |||||||
8 | 2 ms | 3428 kb | 1 | Accepted | |||||||
9 | 2 ms | 3352 kb | 1 | Accepted | |||||||
10 | 2 ms | 3428 kb | 1 | Accepted | |||||||
11 | 2 ms | 3384 kb | 1 | Accepted | |||||||
Source Code
/* Author: Tazim(The_crawler) */ #include<bits/stdc++.h> #define ll long long int #define dec greater<int>() #define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower); #define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper); #define prow(n) for(auto i:n)cout<<i<<" ";cout<<endl; #define pcol(n) for(auto i:n)cout<<i<<endl; #define yes cout<<"YES"<<endl; #define no cout<<"NO"<<endl; #define debug(x) cout<<#x<<" = ";_print(x); cout<<endl; /// Debug function using namespace std; ///**** bool sortbysec(const pair<int, int>& a, const pair<int, int>& b) { return (a.second < b.second); } template<class T> void _print(T x) { cout << x; } template<class T> void _print(vector<T>x) { cout << "[ ";for (T i : x)cout << i << " ";cout << "]"; } template<class T> void _print(set<T>x) { cout << "[ ";for (T i : x)cout << i << " ";cout << "]"; } template<class T, class V> void _print(pair<T, V>x) { cout << "{" << x.first << "," << x.second << "} "; } template<class T, class V> void _print(map<T, V>x) { cout << "[ ";for (auto i : x)_print(i);cout << "]"; } template<class T> void _print(multiset<T>x) { cout << "[ ";for (T i : x)cout << i << " ";cout << "]"; } /* Hack my code. It's Easy to Read */ bool isprime(int n) { if (n < 2)return 0; if (n == 2)return 1; for (int i = 2; i * i <= n; i++) { if (n % i == 0)return 0; } return 1; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // start int t; cin >> t; while (t--) { ll n; cin >> n; int a = __builtin_popcountll(n); if (isprime(a))cout << "Binary prime" << endl; else cout << -1 << endl; } return 0; }