[codeforces 1301A] Three Strings 同一位上c元素与a或b元素相同,该位过关

Codeforces Round #619 (Div. 2)

[codeforces 1301A] Three Strings 同一位上c元素与a或b元素相同,该位过关

总目录详见https://blog.csdn.net/mrcrack/article/details/103564004

在线测评地址https://codeforces.com/contest/1301/problem/A

Problem Lang Verdict Time Memory
A - Three Strings GNU C++11 Accepted 31 ms 0 KB

同一位上c元素与a或b元素相同,该位过关

#include <stdio.h>
#include <string.h>
#define maxn 110
char a[maxn],b[maxn],c[maxn];
int main(){
	int t,len,i;
	scanf("%d",&t);
	while(t--){
		scanf("%s%s%s",a+1,b+1,c+1);
		len=strlen(a+1);
		for(i=1;i<=len;i++)
			if(a[i]==c[i]||b[i]==c[i])continue;
			else break;
		if(i==len+1)printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}
发布了537 篇原创文章 · 获赞 529 · 访问量 44万+

猜你喜欢

转载自blog.csdn.net/mrcrack/article/details/104309418