fork download
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3.  
  4.  
  5. int main(void) {
  6. // scan input
  7. int n;
  8. scanf("%d",&n);
  9. int poetry[30][2][7];
  10. int i,j,k;
  11. for(i=0;i<n;i++)
  12. for(j=0;j<2;j++)
  13. for(k=0;k<7;k++)
  14. scanf("%d",&poetry[i][j][k]);
  15.  
  16.  
  17. //process data & print result
  18. bool disobey,A,B,C;
  19. for(i=0;i<n;i++){
  20. disobey=0;
  21. A=B=C=0; //(0代表遵守,1代表不遵守)
  22. //A rule
  23. A=poetry[i][0][1]==poetry[i][0][3]||poetry[i][1][1]==poetry[i][1][3]||
  24. poetry[i][0][1]!=poetry[i][0][5]||poetry[i][1][1]!=poetry[i][1][5];
  25. if(A){
  26. printf("A");
  27. disobey=1;
  28. }
  29. //B rule
  30. B=poetry[i][0][6]!=1||poetry[i][1][6]!=0;
  31. if(B){
  32. printf("B");
  33. disobey=1;
  34. }
  35. //C rule
  36. C=poetry[i][0][1]==poetry[i][1][1]||
  37. poetry[i][0][3]==poetry[i][1][3]||
  38. poetry[i][0][5]==poetry[i][1][5];
  39. if(C){
  40. printf("C");
  41. disobey=1;
  42. }
  43. if(!disobey) printf("None");
  44. if(i<n-1) printf("\n");
  45. }
  46. return 0;
  47. }
  48.  
Success #stdin #stdout 0.01s 5320KB
stdin
3
0 1 0 0 0 1 1
1 0 1 1 1 0 0
0 1 0 1 1 1 0
1 0 0 0 0 0 1 
0 1 0 0 1 1 1 
1 0 0 0 0 1 1
stdout
None
AB
ABC