Description
Bob讨厭複雜的數學運算.
看到練習冊上的算術題,Bob很是頭痛.
為了完成作業,Bob想要你幫忙寫一個文本版的四則運算電腦.
這個電腦的功能需求十分簡單,隻要可以處理加減乘除和括号就可以了.
你能夠幫助Bob嗎?
Input
每個樣例一行,輸入一個長度小于1500的包含有'(',')','+','-','*','/',和'1'~'9'組成的四則運算表達式.
對于每個樣例,參與運算數字在0~10000之間,表達式運算的結果在double的表示範圍内.
Output
對于每一個例子,輸出表達式的計算結果,精确到小數點後4位
Sample Input
3928*3180*3229+2137
2477*8638
1535+7452+3780+2061*280/3070/(7828-9348)
Sample Output
40333570297.0000
21396326.0000
12766.8763
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn = 1005;
int x, y, vx, r1, r2, t1, t2;
double t[3][3];
bool flag;
int main()
{
while (scanf("%d%d%d", &vx, &x, &y) != EOF)
{
scanf("%d%d%d%d", &t1, &r1, &t2, &r2);
flag = false;
if (r1 < y || r2 < y) flag = false;
else
{
t[1][0] = (x + sqrt(1.0*r1*r1 - y*y)) / vx;
t[1][1] = (x - sqrt(1.0*r1*r1 - y*y)) / vx;
t[2][0] = (x + sqrt(1.0*r2*r2 - y*y)) / vx;
t[2][1] = (x - sqrt(1.0*r2*r2 - y*y)) / vx;
for (int i = 0; i <= 1;i++)
for (int j = 0; j <= 1; j++)
{
if (t[1][i]>=t1&&t[2][j] - t[1][i]>=t2) flag = true;
if (t[2][i]>=t2&&t[1][j] - t[2][i]>=t1) flag = true;
}
}
printf("%s\n", flag ? "Yes" : "No");
}
return 0;
}