/*******************************************************************************
坑爹的地方比較多,首先所有質量都是沒用的,因爲無摩擦力;其次座標最好都用double表示;還有那個
土豆是的座標是相對於第一個peak的座標,第四貌似有土豆可以不在peak的範圍內。。。以後找min/max值
還是用第一個元素做標記比較好。。。
*******************************************************************************/
#include <iostream>
#include <functional>
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <utility>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <limits>
#include <memory>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
using namespace std;
#define LOWBIT(x) ( (x) & ( (x) ^ ( (x) - 1 ) ) )
#define CLR(x, k) memset((x), (k), sizeof(x))
#define CPY(t, s) memcpy((t), (s), sizeof(s))
#define SC(t, s) static_cast<t>(s)
#define LEN(s) static_cast<int>( strlen((s)) )
#define SZ(s) static_cast<int>( (s).size() )
typedef double LF;
typedef __int64 LL; //VC
typedef unsigned __int64 ULL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VF;
typedef vector<string> VS;
template <typename T>
T sqa(const T & x)
{
return x * x;
}
template <typename T>
T gcd(T a, T b)
{
if (!a || !b)
{
return max(a, b);
}
T t;
while (t = a % b)
{
a = b;
b = t;
}
return b;
};
const int INF_INT = 0x3f3f3f3f;
const LL INF_LL = 0x7fffffffffffffffLL; //15f
const double oo = 10e9;
const double eps = 10e-7;
const double PI = acos(-1.0);
#define ONLINE_JUDGE
const int MAXN = 10004;
int test, n, m, w;
struct Peak
{
LF x, h;
}peak[MAXN];
struct Point
{
LF x, v;
}pnt[MAXN];
void ace()
{
int cas = 1;
LF ans = 0;
for (cin >> test; test--; ++cas)
{
cin >> n >> m >> w;
LF maxh = peak[0].h;
for (int i = 0; i < n; ++i)
{
cin >> peak[i].x >> peak[i].h;
maxh = max(maxh, peak[i].h);
}
ans = sqrt(2.0 * 20 * (maxh - peak[0].h));
for (int i = 0; i < m; ++i)
{
int tw;
cin >> pnt[i].x >> pnt[i].v >> tw;
pnt[i].x += peak[0].x;
for (int k = 0; k < n - 1; ++k)
{
if (peak[k].x < pnt[i].x + eps && pnt[i].x < peak[k + 1].x)
{
LF dh = peak[k + 1].h - peak[k].h;
LF dx = peak[k + 1].x - peak[k].x;
LF ph = peak[k].h + (pnt[i].x - peak[k].x) / dx * dh;
LF buf = pnt[i].v * pnt[i].v + 2.0 * 20 * (ph - peak[0].h);
if (buf + eps > 0)
{
ans = max(ans, sqrt(buf));
}
break ;
}
}
}
printf("Case %d: %.2lf\n", cas, ans);
}
return ;
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
ace();
return 0;
}
/*******************************************************************************
Test Data...
1
6 2 100
0 0
2 5
3 2
4 1
5 3
8 -2
2 15 100
5 11 100
*******************************************************************************/
HDU 4036 物理坑爹題
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.