Loading...
Submission
Id When Author Problem Language CPU Memory Verdict
17886 2024-04-24 03:37:42 ewu_intra24_mock_u_84 Binary Prime C 0 ms 1532 kb Wrong Answer - 1
Test Cases
CPU Memory Verdict
1 0 ms 1532 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.  
  3. int main()
  4. {
  5. int a[20], n, t, i, sum = 0, flag = 0;
  6. scanf("%d", &t);
  7. if(1<= t && t<=100){
  8. scanf("%d", &n);
  9. if(1<= n && n<=1000000000000){
  10. for(i = 0; i<t; i++){
  11. a[i] = n%2;
  12. n = n/2;
  13. }
  14. for(i = i - 1; i>=0; i--){
  15. sum += a[i];
  16. }
  17. if(sum==0 || sum==1){
  18. flag = 1;
  19. }
  20. for(int j = 2;j<sum/2;j++){
  21. if(sum%j==0){
  22. flag = 1;
  23. break;
  24. }
  25. }
  26. if(flag == 0) printf("Binary prime");
  27. else printf("%d", -1);
  28.  
  29. }
  30.  
  31. }
  32. return 0;
  33. }
  34.