#include<stdio.h>#include<stdlib.h>int main () {int N,MAXA,MAXB; maxa=maxb=-1;int a[3]={0},b[3]={0};0,1,2 position, respectively, win, draw, failure. Number of fill inint harsh1[3]={0},harsh2[3]={0};0: Cloth, 1 Hammer, 2 scissors: scanf ("%d", &n);Forint t=0; T<n; ++t) {GetChar ();Absorb extra space to ensure the following inputChar A, B; scanf"%c%c", &a,&b);if (a==b) {++a[1]; ++b[1]; }else {C Stands for "Hammer", J for "Scissors", B for "cloth"if (a==' C ' && b==' J ') {++a[0]; ++b[2]; harsh1[1]+=1; }if (a==' J ' && b==' B ') {++a[0]; ++b[2]; harsh1[2]+=1; }if (a==' B ' && b==' C ') {++a[0]; ++b[2]; harsh1[0]+=1; }if (a==' C ' && b==' B ') {++a[2]; ++b[0]; harsh2[0]+=1; }if (a==' B ' && b==' J ') {++a[2]; ++b[0]; harsh2[2]+=1; }if (a==' J ' && b==' C ') {++a[2]; ++b[0]; harsh2[1]+=1; } } }Char p1,p2;Forint i=0; i<3; ++i)if (Harsh1[i]>maxa) {maxa=harsh1[i];if (i==0) p1=' B ';Elseif (i==1) p1=' C ';else p1=' J '; }Forint i=0; i<3; ++i)if (HARSH2[I]>MAXB) {maxb=harsh2[i];if (i==0) p2=' B ';Elseif (i==1) p2= ' C '; else p2= ' J ';} printf ( " Span class= "Content" >%d%d%d\n "A[0],a[1],a[2]); printf ( "%d%d%d\n0],b[1],b[2]); printf ( Span class= "string" > "%c%c\n //system ("pause"); return 0;}
pat:1018. Hammer and Scissors cloth (+) AC