#25461: C++


chun1211 (星星亮晶晶)

School : 國立武陵高級中學
ID : 154333
IP address : [36.225.98.206]
Last Login :
2021-06-18 21:24:15
b884. 電腦教室的傑克 | From: [114.43.61.9] | Post Date : 2021-05-22 21:46

可簡化數學公式

讓yee=100-(x+y)

且x跟y要取絕對值

 

#include<iostream>

#include<cstdlib>

using namespace std;

int main()

{

int i,n,x,y,yee;

cin>>n;

for(i=1;i<=n;i++)

{

cin>>x>>y;

if(x<0)

{

x=-x;

}

if(y<0)

{

y=-y;

}

 

yee=100-x-y;

 

 

if(0<yee && yee<=30)

{

cout<<"sad!"<<endl;

}

else if(30<yee && yee<=60)

{

cout<<"hmm~~"<<endl;

}

else if(60<yee && yee<100)

{

cout<<"Happyyummy"<<endl;

}

else

{

cout<<"evil!!"<<endl;

}

}

 
ZeroJudge Forum