读取字符串后
依次判断就好了~
#include<stdio.h>
int main() {
int T;
int N;
int i;
char s1[10200],s2[10200];
scanf("%d",&T);
while(T--) {
scanf("%d",&N);
scanf("%s %s",s1,s2);
for(i=0; i<N; i++) {
if((s1[i]=='Y'&&s2[i]=='Z')||(s2[i]=='T'&&(s1[i]=='W'||s1[i]=='L'))||(s1[i]=='D'&&s2[i]=='X'))
continue;
else
break;
}
if(i<N)
printf("YZ同学什么都没拿到T_T\n");
else
printf("YZ同学得到了许多金币^_^\n");
}
}
题目地址:【郑轻】[1821]YZ的解密游戏