题解 | #竞选社长#

竞选社长

http://www.nowcoder.com/practice/45a30e3ef51040ed8a7674984d6d1553

#include<stdio.h>
int main()
{
    int ct1=0,ct2=0;
    char p;
    //就是当输入一个整型,且这个整型的数不是0时,条件成立,否则,若输入0,则跳过while里面的内容
    while(~scanf("%c",&p))
    {
        if (p == '0')
        {
            break;
        }
        if( p == 'A')
        {
            ct1=ct1+1;
        }
        if (p == 'B')
        {
            ct2=ct2+1;
        }
    }
    if (ct1>ct2)
        {
            printf("A");
        }
        else if(ct1==ct2)
        {
            printf("E");
        }
        else
        {
            printf("B");
        }
return 0;
}








全部评论

相关推荐

点赞 评论 收藏
分享
在备战秋招的蛇:这波和id配合得不是很好
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务