Loading...
Submission
Id When Author Problem Language CPU Memory Verdict
16708 2024-04-09 16:31:46 Sadman_sadi_anik_241 Binary Prime C 0 ms 1880 kb Wrong Answer - 1
Test Cases
CPU Memory Verdict
1 0 ms 1880 kb Wrong Answer
2 - - Skipped
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<math.h>
  3. int main()
  4. {
  5. int A,i,j,B,l,sum;
  6. scanf("%d",&A);
  7. for(i=1; i<=A; i++)
  8. {
  9. scanf("%d",&B);
  10. sum=0;
  11. j=1;
  12. while(1)
  13. {
  14.  
  15.  
  16. l=B%2;
  17. sum=sum+l;
  18. B=B/2;
  19. l=0;
  20. if(B==0)
  21. break;
  22. j++;
  23. }
  24.  
  25. if (sum <= 1)
  26. {
  27. printf("-1\n ");
  28. }
  29.  
  30. else if(sum%2==0)
  31. {
  32. printf("-1\n");
  33. }
  34.  
  35. else if(sum==2)
  36. {
  37. printf("Binary prime\n");
  38. }
  39. else if(sum==3)
  40. {
  41. printf("Binary prime\n");
  42. }
  43.  
  44. else
  45. {
  46.  
  47. for (int k = 2; k <= sqrt(sum); k++)
  48. {
  49. if (sum % k == 0)
  50. {
  51. printf("-1\n");
  52. }
  53. else
  54. {
  55. printf("Binary prime\n");
  56. }
  57.  
  58.  
  59. }
  60. }
  61.  
  62. }
  63. }
  64.  
  65.  
  66.  
  67.  
  68.