LightOJ 1311 Unlucky Bird (物理题)
题意:有点长,意思是说有一个鸟,在两列火车之间不停的来回飞,两列相距为d时,都开始减速,直到最后停止下来,正好是相距0米,
现在给定两列车的速度和减速时的加速度,和鸟的速度求 d 和鸟飞过的路程。
析:就是一个简单的追及相遇问题,注意的是求的飞行时间时,要计算两列火车制动时间最长的那个。
代码如下:
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <cctype>
#include <cmath>
#include <stack>
#include <sstream>
#define debug() puts("++++");
#define gcd(a, b) __gcd(a, b)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define freopenr freopen("in.txt", "r", stdin)
#define freopenw freopen("out.txt", "w", stdout)
using namespace std; typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const LL LNF = 1e16;
const double inf = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 1e5 + 10;
const int mod = 1e9 + 7;
const int dr[] = {-1, 0, 1, 0};
const int dc[] = {0, 1, 0, -1};
const char *de[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
int n, m;
const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
inline bool is_in(int r, int c){
return r >= 0 && r < n && c >= 0 && c < m;
} int main(){
int T; cin >> T;
for(int kase = 1; kase <= T; ++kase){
double v1, v2, v3, a1, a2;
cin >> v1 >> v2 >> v3 >> a1 >> a2;
double d = v1 * v1 / (2.0*a1) + v2 * v2 / (2.0*a2);
double ans = v3 * max(v1 / a1, v2 / a2);
printf("Case %d: %.10f %.10f\n", kase, d, ans);
}
return 0;
}
LightOJ 1311 Unlucky Bird (物理题)的更多相关文章
- LightOJ - 1311 - Unlucky Bird(相遇问题)
链接: https://vjudge.net/problem/LightOJ-1311 题意: A bird was flying on a train line, singing and passi ...
- Codeforces Round #114 (Div. 1) A. Wizards and Trolleybuses 物理题
A. Wizards and Trolleybuses Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/conte ...
- HDOJ 1330 Deck(叠木块-物理题啊!贪心算法用到了一点)
Problem Description A single playing card can be placed on a table, carefully, so that the short edg ...
- hdu 5761 Rower Bo 物理题
Rower Bo 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5761 Description There is a river on the Ca ...
- hdu 5066 小球碰撞(物理题)
http://acm.hdu.edu.cn/showproblem.php?pid=5066 中学物理题 #include <cstdio> #include <cstdlib> ...
- hdoj 4445 Crazy Tank 物理题/枚举角度1
Crazy TankTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S ...
- Bungee Jumping---hdu1155(物理题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1155 题目很长,但是很容易理解,就是人从高s的桥上跳下来,手拉着长为l的绳子末端,如果绳子太短那么人将 ...
- [物理题+枚举] hdu 4445 Crazy Tank
题意: 给你N个炮弹的发射速度,以及炮台高度H和L1,R1,L2,R2. 问任选发射角度.最多能有几个炮弹在不打入L2~R2的情况下打入L1~R1 注意:区间有可能重叠. 思路: 物理题,发现单纯的依 ...
- HDU 1155 Bungee Jumping(物理题,动能公式,弹性势能公式,重力势能公式)
传送门: Bungee Jumping Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Othe ...
随机推荐
- POJ 2230 Watchcow 【欧拉路】
Watchcow Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 6336 Accepted: 2743 Specia ...
- jsonpath对json数据进行分析校验做接口测试
在做接口测试的时候, 我们需要对返回的数据进行分析校验, 一般返回的都是json格式的数据, 怎么来解析校验呢? 之前有看过使用递归遍历json数据的, 然后找到了jsonpath, 可以很方便的对j ...
- winform 中的Anchor 和 Dock 属性设置
在设计窗体时,这两个属性特别有用,如果用户认为改变窗口的大小并不容易,应确保窗口看起来不显得很乱,并编写许多代码行来达到这个目的,许多程序解决这个问题是地,都是禁止给窗口重新设置大小,这显然是解决问题 ...
- bzoj 2594: 水管局长数据加强版 Link-Cut-Tree
题目: Description SC省MY市有着庞大的地下水管网络,嘟嘟是MY市的水管局长(就是管水管的啦),嘟嘟作为水管局长的工作就是:每天供水公司可能要将一定量的水从x处送往y处,嘟嘟需要为供水公 ...
- 【LeetCode】024. Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2-&g ...
- 浅谈vue路由原理
Vue的路由实现:hash模式 和 history模式 hash模式:在浏览器中符号“#”,#以及#后面的字符称之为hash,用window.location.hash读取: 特点:hash虽然在UR ...
- redis的五种数据类型及应用场景
前言 redis是用键值对的形式来保存数据,键类型只能是String,但是值类型可以有String.List.Hash.Set.Sorted Set五种,来满足不同场景的特定需求. 本博客中的示例不是 ...
- C/C++面试题总结(1)
首先说一下,这些东西,有的是必须掌握的,有的是面试时你讲出来就是闪光点.自己把握.把握不好的都搞懂.实在不行背下来. 由于时间关系,总结的比较随意,有的就直接贴链接了,希望理解一下. 第一篇:基础(必 ...
- yeoman,grunt,bower
Yeoman主要有三部分组成:yo(脚手架工具).grunt(构建工具).bower(包管理器).这三个工具是分别独立开发的,但是需要配合使用,来实现我们高效的工作流模式. http://www.cn ...
- python中如何定义main方法
我们有时写的python模块需要自己测试, 简单方法就是定义main函数, 然后测试自己的模块接口. def main(): test_yourCode() if __name__ == & ...