2015
04-14

# Angry Birds Again

luyi0619 loves playing the popular game �C angry bird. You haven’t heard about it? Oh, my god! You are out, I think. The following hyperlink to Wikipedia will help you.

Every day, he spends lot of time playing the game. You know, as time goes, he will be bored. This time, when he hits a pig successfully he wants to calculate the distance that bird covers. As a clever programmer, can you help him to solve the problem?

The gravity acceleration is 9.80 m/s^2.

The first line contains only one integer T (T is about 100) indicates the number of test cases.

For each case there are five integers x0,y0,x1,y1,t;

x0,y0 is the bird’s position.

x1,y1 is the pig’s position.

t is the time that the bird used to cover the distance.

All integers above are non-negative and in the range [0,100]

x0 and x1 are never equal.

The first line contains only one integer T (T is about 100) indicates the number of test cases.

For each case there are five integers x0,y0,x1,y1,t;

x0,y0 is the bird’s position.

x1,y1 is the pig’s position.

t is the time that the bird used to cover the distance.

All integers above are non-negative and in the range [0,100]

x0 and x1 are never equal.

1
0 0 2 2 1

3.687

#include <iostream>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <cstdio>
#include <queue>
#include <cmath>
#include <algorithm>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define clr(a, b) memset(a, b, sizeof(a))
#define SZ(a) ((int)a.size())
#define PB push_back
#define MP make_pair
#define inf 0x3f3f3f3f
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;

#ifdef ecust
#define R "%lld"
#else
#define R "%I64d"
#endif

namespace acm {

double x0, y0, x1, y1;
double vx, vy;
double t;

double fun(double x){
return 1.0/9.8*(x/2*sqrt(x*x+vx*vx)+vx*vx/2*log(x+sqrt(x*x+vx*vx)));
}

void solve(){
scanf("%lf%lf%lf%lf%lf", &x0, &y0, &x1, &y1, &t);
if(fabs(t) <= 1e-8) {puts("Impossible."); return;}
vx = ((x1 - x0))/t;
vy = ((y1 - y0) + 0.5*9.8*t*t)/t;
printf("%.3lf\n", fun(vy)-fun(vy-9.8*t));
}

void icpc(){
int cas; scanf("%d", &cas);
while(cas--){
solve();
}
}
}

int main() {
#ifdef ecust
freopen("in", "r", stdin);
#endif
acm::icpc();
//	cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;
}

1. 第2题，TCP不支持多播，多播和广播仅应用于UDP。所以B选项是不对的。第2题，TCP不支持多播，多播和广播仅应用于UDP。所以B选项是不对的。

2. 思路二可以用一个长度为k的队列来实现，入队后判断下队尾元素的next指针是否为空，若为空，则出队指针即为所求。

3. 5.1处，反了；“上一个操作符的优先级比操作符ch的优先级大，或栈是空的就入栈。”如代码所述，应为“上一个操作符的优先级比操作符ch的优先级小，或栈是空的就入栈。”