HDU 4036 物理坑爹题
2012-01-06 00:06
267 查看
/******************************************************************************* 坑爹的地方比较多,首先所有质量都是没用的,因为无摩擦力;其次坐标最好都用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
- HDU 4036 Rolling Hongshu(数学+物理应用)
- hdu 4036 物理题
- hdu 5826 physics 物理+数学微分方程
- hdu 1155 Bungee Jumping(物理题——能量守恒)
- hdu 5066 小球碰撞(物理题)
- HDU 2298(物理题,纯公式计算)
- hdu 5826 物理题
- hdu 1155 Bungee Jumping(物理题——能量守恒)
- HDU 3940 The Angry Birds 物理题
- hdu 4969 物理/积分
- hdu 5066 小球碰撞(物理题)
- HDU 5826 physics(物理)
- HDU 4036 存疑题目,数论 难度:1
- [物理题] hdu 1155 Bungee Jumping
- hdu 4036 - Rolling Hongshu
- HDU 5761 Rower Bo(物理)
- HDU - 4712 Hamming Distance(坑爹的随机数算法 + 暴力求解)
- hdu 1155 Bungee Jumping(物理题——能量守恒)
- HDU 4969 Just a Joke(简短神代码)计算几何,物理题(数据超弱)