Time limit MS Memory limit 65536 KB code length limit 8000 B procedure StandardAuthor Chen, Yue
Everyone should play "Hammer and Scissors Cloth" game: two people at the same time give gestures, the rule of victory:
Now give a record of the confrontation between two people, please count the wins, flat, negative number of both sides, and give the two sides what gesture of the greatest odds.
Input format:
Enter line 1th to give the positive integer n (<=105), that is, the number of times the two sides clash. Then n lines, each row gives the information of a confrontation, that is, a, b both sides of the gesture given at the same time. C for "Hammer", J for "Scissors", B for "cloth", 1th letter for party A, 2nd for party B, 1 spaces in the middle.
Output format:
Output 1th, 2 respectively give a, B wins, flat, negative times, the number between 1 spaces separated. The 3rd line gives two letters, representing the most winning gestures of A and b, with 1 spaces in the middle. If the solution is not unique, the solution with the smallest alphabetic order is output.
Input Sample:
10C JJ BC bb bb cc cc BJ BB CJ J
Sample output:
5 3 3 5B B
1#include <stdio.h>2 intMain () {3 intN;4 intb=0;5 intC=0;6 intj=0;7 intyb=0;8 intYc=0;9 intyj=0;Ten One CharJia; A CharYi; - intjiasheng=0; - intyisheng=0; the intping=0; -scanf"%d",&n); - GetChar (); - for(intI=0; i<n;i++){ +Jia=GetChar (); - GetChar (); +Yi=GetChar (); A GetChar (); at if(jia==Yi) { -Ping + +; -}Else if(jia=='B'&& yi=='C'){ -b++; -jiasheng++; -}Else if(jia=='C'&& yi=='J'){ inC++; -jiasheng++; to}Else if(jia=='J'&& yi=='B'){ +J + +; -jiasheng++; the}Else if(jia=='B'&& yi=='J'){ *yj++; $yisheng++;Panax Notoginseng}Else if(jia=='C'&& yi=='B'){ -yb++; theyisheng++; +}Else if(jia=='J'&& yi=='C'){ AYc++; theyisheng++; + } - } $printf"%d%d%d\n", jiasheng,ping,n-jiasheng-ping); $printf"%d%d%d\n", n-jiasheng-Ping,ping,jiasheng); - - the if(B>=c && b>=j) { -printf"B");Wuyi}Else if(c>b&&c>=j) { theprintf"C"); -}Else if(J>b && j>c) { Wuprintf"J"); - } About $ if(Yb>=yc && yb>=YJ) { -printf"B"); -}Else if(yc>yb&&yc>=YJ) { -printf"C"); A}Else if(Yj>yb && yj>YC) { +printf"J"); the } - $ the return 0; the}
1018. Hammer and Scissors cloth (20)