博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 4036 物理坑爹题
阅读量:2440 次
发布时间:2019-05-10

本文共 2504 字,大约阅读时间需要 8 分钟。

/*******************************************************************************   坑爹的地方比较多,首先所有质量都是没用的,因为无摩擦力;其次坐标最好都用double表示;还有那个土豆是的坐标是相对于第一个peak的坐标,第四貌似有土豆可以不在peak的范围内。。。以后找min/max值还是用第一个元素做标记比较好。。。*******************************************************************************/#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
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
(s)#define LEN(s) static_cast
( strlen((s)) )#define SZ(s) static_cast
( (s).size() )typedef double LF;typedef __int64 LL; //VCtypedef unsigned __int64 ULL;typedef pair
PII;typedef pair
PLL;typedef pair
PDD;typedef vector
VI;typedef vector
VC;typedef vector
VF;typedef vector
VS;template
T sqa(const T & x){ return x * x;}template
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; //15fconst double oo = 10e9;const double eps = 10e-7;const double PI = acos(-1.0);#define ONLINE_JUDGEconst 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...16 2 1000 02 53 24 15 38 -22 15 1005 11 100*******************************************************************************/

转载地址:http://dibqb.baihongyu.com/

你可能感兴趣的文章
初学者 编程_初学者可访问性
查看>>
redis中只能保存字符串_如何在Redis中管理字符串
查看>>
Electron.js简介-第1部分:设置
查看>>
盖茨比乔布斯_在盖茨比中使用插件
查看>>
css nth-child_比较CSS伪类:nth-child与nth-of-type
查看>>
React Hooks入门
查看>>
centos安装nginx_如何在CentOS 8上安装Nginx
查看>>
graphql 嵌套查询_了解GraphQL中的查询
查看>>
如何在Ruby中使用数组方法
查看>>
如何在Ubuntu 20.04上安装R
查看>>
如何在CentOS 8上安装MySQL
查看>>
Apollo Boost简介
查看>>
strapi_使用Strapi构建自定义API
查看>>
graphql解析器_GraphQL中的架构和解析器
查看>>
debian创建交换分区_如何在Debian 8上添加交换空间
查看>>
debian创建交换分区_如何在Debian 9上添加交换空间
查看>>
debian安装nginx_如何在Debian 10上安装Nginx
查看>>
金蝶kis可用库存查询_如何建立可用库存
查看>>
vue密码正则验证表单验证_如何在Vue中使用表单验证
查看>>
particles.js_使用Particles.js创建很棒的背景效果
查看>>