Loading...
Submission
Id When Author Problem Language CPU Memory Verdict
17910 2024-04-24 09:06:27 ewu_intra24_mock_u_84 Binary Prime C 0 ms 1544 kb Wrong Answer - 2
Test Cases
CPU Memory Verdict
1 0 ms 1544 kb Accepted
2 0 ms 1536 kb Wrong Answer
3 - - Skipped
4 - - Skipped
5 - - Skipped
6 - - Skipped
7 - - Skipped
8 - - Skipped
9 - - Skipped
10 - - Skipped
11 - - Skipped
Source Code
program.c
Download
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3. bool Isprime(int num){
  4. if (num <= 1) return 0;
  5. if (num <= 3) return 1;
  6.  
  7. if (num % 2 == 0 || num % 3 == 0) return 0;
  8.  
  9. for (int i = 5; i * i <= num; i = i + 6) {
  10. if (num % i == 0 || num % (i + 2) == 0) return 0;
  11. }
  12.  
  13. return 1;
  14. }
  15. int main()
  16. {
  17. int a[20], n, t, i, sum = 0, flag = 0;
  18. scanf("%d", &t);
  19. if(1<= t && t<=100){
  20. for(int j = 1; j<=t;j++){
  21. scanf("%d", &n);
  22. if(1<= n && n<=1000000000000){
  23. for(i = 0;n>0; i++){
  24. a[i] = n%2;
  25. n = n/2;
  26. }
  27. for(i = i - 1; i>=0; i--){
  28. sum += a[i];
  29. }
  30. }
  31. if(Isprime(sum)) printf("Binary prime\n");
  32. else printf("%d\n",-1);
  33. }
  34. }
  35.  
  36. return 0;
  37. }