当前位置:网站首页>Who is the winner of PTA

Who is the winner of PTA

2022-07-06 02:54:00 weCream

watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAd2VDcmVhbQ==,size_20,color_FFFFFF,t_70,g_se,x_16

watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAd2VDcmVhbQ==,size_20,color_FFFFFF,t_70,g_se,x_16 

  answer :

#include<stdio.h>
int main(){
    int n,m,i,j,k,l,t;
    scanf("%d%d",&n,&m);
    int a[3],num=0;
    for(i=0;i<3;i++)
    scanf("%d",&a[i]);
    int flag=0;
    if(n>m){
        for(i=0;i<3;i++){
            if(a[i]==0)
            num++;
        }
        if(num!=0){
            printf("The winner is a: %d + %d",n,num);
        }
        else printf("The winner is b: %d + 3",m);
    }
    else{
        for(i=0;i<3;i++){
            if(a[i]==1)
            num++;
        }
        if(num!=0){
            printf("The winner is b: %d + %d",m,num);
        }
        else printf("The winner is a: %d + 3",n);
    }
}

watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAd2VDcmVhbQ==,size_20,color_FFFFFF,t_70,g_se,x_16

  Limited ability , The code is not concise enough , I hope the boss will criticize and correct me .

原网站

版权声明
本文为[weCream]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202132345000072.html