洛谷 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;
}
本文来自博客园,作者:PandaBlack,转载请注明原文链接:https://www.cnblogs.com/liu-black/p/uva12646-tijie.html