洛谷 UVA12646 题解

题目传送门


题意:

给出三个数 \(A,B,C\),其中 \(A,B,C\)\(0\)\(1\),如果三个数相等输出 *,否则输出与另外两个数不同的数。


思路:

直接根据题意进行模拟即可,要注意的是有多组输入,可以用 while 进行输入,然后对每组数据分别进行判断。


code:

#include <bits/stdc++.h>
using namespace std;

int a,b,c;

int main(){
	while(scanf("%d%d%d",&a,&b,&c) != EOF){
		if(a==b && a==c && b==c)	cout<<"*"<<endl;
		else if(a==c)	cout<<"B"<<endl;
		else if(b==c)	cout<<"A"<<endl;
		else if(a==b)	cout<<"C"<<endl;
	}
	return 0;
}


posted @ 2022-04-05 17:46  PandaBlack  阅读(80)  评论(0)    收藏  举报