Submission
# | When | Author | Problem | Language | CPU | Memory | |
---|---|---|---|---|---|---|---|
20874 | 2024-06-13 22:24:21 | AHAMMED_99 | Binary Prime | C | 0 ms | 1452 kb | Accepted |
Test Cases
# | CPU | Memory | Points | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 0 ms | 1452 kb | 1 | Accepted | |||||||
2 | 0 ms | 1440 kb | 1 | Accepted | |||||||
3 | 0 ms | 1344 kb | 1 | Accepted | |||||||
4 | 0 ms | 1332 kb | 1 | Accepted | |||||||
5 | 0 ms | 1340 kb | 1 | Accepted | |||||||
6 | 0 ms | 1420 kb | 1 | Accepted | |||||||
7 | 0 ms | 1428 kb | 1 | Accepted | |||||||
8 | 0 ms | 1344 kb | 1 | Accepted | |||||||
9 | 0 ms | 1344 kb | 1 | Accepted | |||||||
10 | 0 ms | 1332 kb | 1 | Accepted | |||||||
11 | 0 ms | 1336 kb | 1 | Accepted | |||||||
Source Code
#include <stdio.h> #include <stdbool.h> // Function to check if a number is prime bool isPrime(int n) { if (n <= 1) return false; if (n == 2 || n == 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; // Check for factors from 5 to sqrt(n) with step 6 for (int i = 5; i * i <= n; i += 6) { if (n % i == 0 || n % (i + 2) == 0) return false; } return true; } // Function to count set bits in a number int countSetBits(unsigned long long n) { int count = 0; while (n) { n &= (n - 1); count++; } return count; } int main() { int T; while (T--) { unsigned long long N; int setBits = countSetBits(N); if (isPrime(setBits)) else } return 0; }