數學問題 我的想法是傑克在(1,0)輸出應該是99,屬於Happyyummy範圍
為何是hmm~~
---------------------------------分隔線---------------------------------------------------------
#include <iostream>
#include <math.h>
#include <cmath>
using namespace std;
int main(int argc, char** argv)
{
int yee,x,y;
double r,z;
while(cin >> x >> y)
{
r = x+y;
z = sqrt (r);
yee = 100 - z*z;
if(yee > 0 && yee<= 30)
{
cout << "sad!" <<endl;
}
else if(yee > 30 && yee<= 60)
{
cout << "hmm~~" <<endl;
}
else if(yee > 60 && yee< 100)
{
cout << "Happyyummy" <<endl;
}
else
{
cout << "evil!!" <<endl;
}
}
return 0;
}
數學問題 我的想法是傑克在(1,0)輸出應該是99,屬於Happyyummy範圍
為何是hmm~~
---------------------------------分隔線---------------------------------------------------------
#include
#include
#include
using namespace std;
int main(int argc, char** argv)
{
int yee,x,y;
double r,z;
while(cin >> x >> y)
{
r = x+y;
z = sqrt (r);
yee = 100 - z*z;
if(yee > 0 && yee<= 30)
{
cout << "sad!" <<endl;
}
else if(yee > 30 && yee<= 60)
{
cout << "hmm~~" <<endl;
}
else if(yee > 60 && yee< 100)
{
cout << "Happyyummy" <<endl;
}
else
{
cout << "evil!!" <<endl;
}
}
return 0;
}
如果 x < 0 , y < 0
你的 sqrt 就 ..... 0u0