洛谷 UVA12646 题解


题目传送门


题意:

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


思路:

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


code:

#include 
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<<"*"<