各位大佬,求帮看看问题出在哪里了
这是题目:题目描述
Fubery found he start to fall in love with lottle school-sister Funv .
As a university fresh man , can you ren ?
Now , try to destroy it !
There are 6 numbers .
You can change the order of the 6 numbers.
Then Funv will take the firse one and the last one , sum the up as her score.
Finally , Fubery can take any of 3 numbers from the left 4 numbers ,and sum them up as his score .
If Fuber's score is smaller than Funv,s , he will lose . If bigger , he will win. if there are equal , HeHe !
输入
There is a number T shows there are T test cases below. ( T <= 50)
For each test case , there are 6 numbers X ( 1 <= X <= 100 ).
输出
If Fubery loses , outout "What a sad story!"
If Fubery win , output "It will be a sad story!"
If they are equal , output "HeHe!"
样例输入
3
1 2 3 3 2 2
5 6 4 3 5 5
1 2 2 2 3 4
样例输出
HeHe!
It will be a sad story!
What a sad story!
这是我写的代码:
#include <iostream>
using namespace std;
int main()
{
int T,i,j,t,w,m,a[6];
while(cin>>T)
{
for(i=0;i<6;i++)
cin>>a[i];
for(j=1;j<6;j++)
for(i=1;i<=6-j;i++)
{
if(a[i]>a[i+1])
{t=a[i];a[i]=a[i+1];a[i+1]=t}
}
w=a[6]+[5];
m=a[4]+a[3]+a[2];
if(w>m)
cout<<"What a sad story!";
else if(w==m)
cout<<"HeHe!";
else cout<<"It will be a sad story!";
}
return 0;
}