PTA-基础编程题目集-7-9 用天平找小球

题目来源:https://pintia.cn/problem-sets/14/problems/789

 

 本来以为因为随便一个数总会和另外的两个数中的一个一样一个不一样所以只需要比较一次就可以得出结果了,是我想当然了。

 

 

 1 #include<stdio.h>
 2 int main(){
 3     int a,b,c;
 4     scanf("%d %d %d",&a,&b,&c);
 5     if(a==b)
 6         printf("C");
 7     if(a==c)
 8         printf("B");
 9     if(b==c)
10         printf("A");
11     return 0;
12 }

 

posted @ 2021-03-24 10:13  Listendown  阅读(41)  评论(0)    收藏  举报