#include <stdio.h>
int main()
{
long long int a=0,b=0,c=0,big1=0,small1=0,middle1=0;
char big2,small2,middle2;
while(scanf("%ld %ld %ld",&a,&b,&c)!=EOF)
{
if(a>b && a>c)
{
big1=a;
big2='A';
}
if(a<b && a<c)
{
small1=a;
small2='A';
}
if(a>b && a<c)
{
middle1=a;
middle2='A';
}
if(a>c && a<b)
{
middle1=a;
middle2='A';
}
if(b>a && b>c)
{
big1=b;
big2='B';
}
if(b<a && b<c)
{
small1=b;
small2='B';
}
if(b>a && b<c)
{
middle1=b;
middle2='B';
}
if(b>c && b<a)
{
middle1=b;
middle2='B';
}
if(c>=a && c>=b)
{
big1=c;
big2='C';
}
if(c<a && c<b)
{
small1=c;
small2='C';
}
if(c>b && c<a)
{
middle1=c;
middle2='C';
}
if(c>a && c<b)
{
middle1=c;
middle2='C';
}
if((middle1+small1>big1)&&(middle1!=small1))
printf("%c\n",middle2);
else if(middle1+small1<big1)
printf("%c\n",big2);
}
}
得出結果是wa line4 有人是同樣問題嗎?
#include
int main()
{
long long int a=0,b=0,c=0,big1=0,small1=0,middle1=0;
char big2,small2,middle2;
while(scanf("%ld %ld %ld",&a,&b,&c)!=EOF)
{
if(a>b && a>c)
{
big1=a;
big2='A';
}
if(a{
small1=a;
small2='A';
}
if(a>b && a<c)
{
middle1=a;
middle2='A';
}
if(a>c && a<b)
{
middle1=a;
middle2='A';
}
if(b>a && b>c)
{
big1=b;
big2='B';
}
if(b{
small1=b;
small2='B';
}
if(b>a && b<c)
{
middle1=b;
middle2='B';
}
if(b>c && b<a)
{
middle1=b;
middle2='B';
}
if(c>=a && c>=b)
{
big1=c;
big2='C';
}
if(c{
small1=c;
small2='C';
}
if(c>b && c<a)
{
middle1=c;
middle2='C';
}
if(c>a && c<b)
{
middle1=c;
middle2='C';
}
if((middle1+small1>big1)&&(middle1!=small1))
printf("%c\n",middle2);
else if(middle1+small1<big1)
printf("%c\n",big2);
}
}
得出結果是wa line4 有人是同樣問題嗎?
應該是因為你沒有考慮到一開始有票數一樣的情況0u0
e.x. 5 5 3