美文网首页
5-9 用天平找小球

5-9 用天平找小球

作者: Muzi_Jin | 来源:发表于2017-04-06 15:55 被阅读0次

Attention: 如果喜欢我写的文章,欢迎来我的github主页给star
Githubgithub.com/MuziJin

三个球A、B、C,大小形状相同且其中有一个球与其他球重量不同。要求找出这个不一样的球。

输入格式:

输入在一行中给出3个正整数,顺序对应球A、B、C的重量。

输出格式:

在一行中输出唯一的那个不一样的球。

输入样例:
1 1 2
输出样例:
C
Code
#include<stdio.h>

int main()
{           
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if(a==b && a!=c)
        printf("C");
    else if(a==c && a!=b)
        printf("B");
    else 
        printf("A");
    return 0;
}

转载请注明出处:github.com/MuziJin

相关文章

网友评论

      本文标题:5-9 用天平找小球

      本文链接:https://www.haomeiwen.com/subject/vgjqattx.html