C 关于重复判断,结果重复输出的疑问

为什么会出现“ The winner is a: 327 + 1The winner is b: 129 + 2”的结果?
输入样例:
327 129
1 0 1
输出样例:
The winner is a: 327 + 1



```c
#include
int main()
{
    int Pa=0,Pb=0,a=0,b=0,c=0,P1=0,P2=0;
    scanf("%d %d",&Pa,&Pb);
    scanf("%d %d %d",&a,&b,&c);
    if(Pa>Pb&&a==0||b==0||c==0)
      {P1=Pa;P2=3-(a+b+c);
       printf("The winner is a: %d + %d",P1,P2);}
    if(Paa==0&&b==0&&c==0)
       {P1=Pa;P2=3;
        printf("The winner is a: %d + %d",P1,P2);}
    if(Paa==1||b==1||c==1)
      {P1=Pb;P2=a+b+c;
       printf("The winner is b: %d + %d",P1,P2);}
    if(Pa>Pb&&a==1&&b==1&&c==1)
       {P1=Pb;P2=3;
        printf("The winner is b: %d + %d",P1,P2);}
    return 0; 
}


```

  • 第一个if,327 > 129 && 1==0 || 0 == 0 || 1 == 0
    相当于 1 && 0 || 1 || 0 , 结果为 1 ,if表达式成立, P1 = 327 , P2 = 3 - 2= 1
    打印 The winner is a: 327 + 1
  • 第二个if,327 < 129 && 1==0 && 0 == 0 && 1 == 0
    第一个就不成立,又都是 && ,if表达式不成立
  • 第三个if,327 < 129 && 1==1 || 0 == 1 || 1 == 1
    相当于 0 || 0 || 1 ,结果为 1, if表达式成立, P1 = 129,P2 = 2
    打印 The winner is b: 129 + 2
  • 第三个if,327 > 129 && 1==1 && 0 == 1 && 1 == 1
    相当于 1 && 1 && 0 && 1 ,结果为 0, if表达式不成立
  • 因为两次打印中间没有换行,一行输出

用了多个 if 条件语句,当输入的条件不满足第一个 if 语句的情况时,就不会执行后面的 if 语句,因此可能输出不符合预期。例如,输入 327 129 和 1 0 1 时,应该输出“The winner is b: 129 + 2”,但实际输出结果为“The winner is a: 327 + 1The winner is b: 129 + 2”。
改了一下,你看一下行不行

#include<stdio.h>
int main()
{
int Pa=0,Pb=0,a=0,b=0,c=0,P1=0,P2=0;
scanf("%d %d",&Pa,&Pb);
scanf("%d %d %d",&a,&b,&c);
if(Pa>Pb){
if(a==0||b==0||c==0){
P1=Pa;P2=3-(a+b+c);
printf("The winner is a: %d + %d",P1,P2);
}
else if(a==1&&b==1&&c==1){
P1=Pb;P2=3;
printf("The winner is b: %d + %d",P1,P2);
}
}
else{
if(a==0&&b==0&&c==0){
P1=Pa;P2=3;
printf("The winner is a: %d + %d",P1,P2);
}
else if(a==1||b==1||c==1){
P1=Pb;P2=a+b+c;
printf("The winner is b: %d + %d",P1,P2);
}
}
return 0;
}

那你觉得应该是什么结果?

谢谢各位解答,我忘了优先级,在或的判断那里加上括号即可。