每日一题4.1.2
每日一题4.1.2
快到碗里来
解题思路: 只需要比较周长和身长就好
容易踩坑: 半径和身长不能设为int型!!! 要设为double型!!!
代码实现:
#include <iostream>
using namespace std;
int Cat(double c,double r)
{
if ((3.14 * 2 * r) > c)
return 0;
else
return -1;
}
int main()
{
double c, r;
while (cin >> c >> r)
{
if (Cat(c, r) == 0)
cout << "Yes" << endl;
if (Cat(c, r) == -1)
cout << "No" << endl;
}
system("pause");
return 0;
}