题意:有点长,意思是说有一个鸟,在两列火车之间不停的来回飞,两列相距为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 (物理题)的更多相关文章

  1. LightOJ - 1311 - Unlucky Bird(相遇问题)

    链接: https://vjudge.net/problem/LightOJ-1311 题意: A bird was flying on a train line, singing and passi ...

  2. 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 ...

  3. HDOJ 1330 Deck(叠木块-物理题啊!贪心算法用到了一点)

    Problem Description A single playing card can be placed on a table, carefully, so that the short edg ...

  4. hdu 5761 Rower Bo 物理题

    Rower Bo 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5761 Description There is a river on the Ca ...

  5. hdu 5066 小球碰撞(物理题)

    http://acm.hdu.edu.cn/showproblem.php?pid=5066 中学物理题 #include <cstdio> #include <cstdlib> ...

  6. hdoj 4445 Crazy Tank 物理题/枚举角度1

    Crazy TankTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  7. Bungee Jumping---hdu1155(物理题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1155 题目很长,但是很容易理解,就是人从高s的桥上跳下来,手拉着长为l的绳子末端,如果绳子太短那么人将 ...

  8. [物理题+枚举] hdu 4445 Crazy Tank

    题意: 给你N个炮弹的发射速度,以及炮台高度H和L1,R1,L2,R2. 问任选发射角度.最多能有几个炮弹在不打入L2~R2的情况下打入L1~R1 注意:区间有可能重叠. 思路: 物理题,发现单纯的依 ...

  9. HDU 1155 Bungee Jumping(物理题,动能公式,弹性势能公式,重力势能公式)

    传送门: Bungee Jumping Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Othe ...

随机推荐

  1. Spring Cloud之Swagger2 API接口管理

    随着微服务架构体系的发展和应用, 为了前后端能够更好的集成与对接,同时为了项目的方便交付,每个项目都需要提供相应的API文档. 来源:PC端.微信端.H5端.移动端(安卓和IOS端) 传统的API文档 ...

  2. 算法(Algorithms)第4版 练习 2.3.25

      代码实现: public static void sort(Comparable[] a) { StdRandom.shuffle(a);//eliminate dependence on inp ...

  3. 大话设计模式--工厂模式 factory -- C++实现实例

    实现<大话设计模式>的C++版本... 1. 工厂模式 使用的范围是 同一个基类,下面很多子类. (1)这里很容易出现的一个问题n多的子类继承自抽象基类,我们不得不在每次要用到子类的地方就 ...

  4. CentOS安装wireshark

    yum install wireshark-gnome yum install libpcap

  5. 分享知识-快乐自己:遍历Map集合

    import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class TestMap { pu ...

  6. 分享知识-快乐自己:FastDFS 上传 java 源码

    FastDFS 上传 java 源码:点我下载源码 首先导入 POM 文件:解决 maven 不能下载 fastdfs-client-java JAR <dependency> <g ...

  7. POJ 2240 Arbitrage(Floyed-Warshall算法)

    题意:给出n种货币,m种兑换比率(一种货币兑换为另一种货币的比率),判断测试用例中套汇是否可行.(套汇的意思就是在经过一系列的货币兑换之后,是否可以获利.例如:货币i→货币j→货币i,这样兑换后,是否 ...

  8. Abp模块分析

    1.什么是模块? 模块化是一种处理复杂系统分解为更好的可管理模块的方式.模块化用来分割,组织和打包软件.每个模块完成一个特定的子功能,所有的模块按某种方法组装起来,成为一个整体,完成整个系统所要求的功 ...

  9. 2.4 AppDelegate 的 3 个生命周期

    Classed/AppDelegate.cpp 文件内容如下: #include "cocos2d.h" #include "CCEGLView.h" #inc ...

  10. NodeJS中 Path 模块

    var path = require('path'); // 当发现有多个连续的斜杠时,会替换成一个: 当路径末尾包含斜杠时,会保留: // 在 Windows 系统会使用反斜杠. var p = p ...