纯模拟
http://202.197.224.59/OnlineJudge2/index.php/Problem/read/id/1190
#include<cstdio> int main() { //freopen("in.txt","r",stdin); int k,i,a,b,sum1,sum2; char x,y; scanf("%d",&k); getchar(); while(k--) { sum1=sum2=0; for(i=1;i<=5;i++) { scanf("%c%d",&x,&a); //printf("%c%d",x,a); getchar(); scanf("%c%d",&y,&b); //printf("%c%d",y,b); if(x==y) { sum1+=a; sum2+=b; } else if((x=='J'&&y=='T')||(x=='S'&&y=='J')||(x=='M'&&y=='S')||(x=='H'&&y=='M')||(x=='T'&&y=='H')) sum1+=a+b; else if((x=='T'&&y=='J')||(x=='J'&&y=='S')||(x=='S'&&y=='M')||(x=='M'&&y=='H')||(x=='H'&&y=='T')) sum2+=a+b; else if((x=='J'&&y=='M')||(x=='S'&&y=='H')||(x=='M'&&y=='T')||(x=='H'&&y=='J')||(x=='T'&&y=='S')) { if(a>b) sum1+=a-b; else sum1+=b-a; } else if((x=='M'&&y=='J')||(x=='H'&&y=='S')||(x=='T'&&y=='M')||(x=='J'&&y=='H')||(x=='S'&&y=='T')) { if(a>b) sum2+=a-b; else sum2+=b-a; } getchar(); } if(sum1>sum2) printf("Jia\n"); else if(sum1<sum2) printf("Yi\n"); else printf("Ping\n"); } return 0; }
时间: 2024-10-21 15:00:35