题意:有点长,意思是说有一个鸟,在两列火车之间不停的来回飞,两列相距为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;
}

  

最新文章

  1. ASP.NET MVC5 网站开发实践(一) - 项目框架
  2. Asp.Net调试方法备忘
  3. Java开发之JSP行为
  4. 实现AJAX的基本步骤 。。转
  5. 【HDU 2160】母猪的故事
  6. java--构造器初始化
  7. hdoj 5349 MZL&#39;s simple problem
  8. 【转】myeclipse 上安装 Maven3
  9. oracle登陆连接的问题
  10. Redis slowlog
  11. SpringMVC 异常处理
  12. xcode调试打印QString
  13. iOS PickerView选择视图
  14. python base64 decode incorrect padding错误解决方法
  15. C# enum、int、string三种类型互相转换
  16. HTML&amp;javaSkcript&amp;CSS&amp;jQuery&amp;ajax(十)
  17. visual stodio 编译前后动作定制总结
  18. display:none和visibility:hidden
  19. arcgis计算邻接矩阵
  20. javascript中的回调函数(callback)

热门文章

  1. Demo Nec
  2. &lt;再看TCP/IP第一卷&gt;关于网络层及协议细节---ICMP协议几个要注意的地方
  3. 大话设计模式--解释器模式 interpreter -- C++实现实例
  4. 修改myEclipse2014web项目名称
  5. npm-install once
  6. spring与mybati整合方法
  7. 关于c++中char*、char ch[]和string区别
  8. 《java编程思想》:字符串
  9. OpenCV——径向模糊
  10. ffmpeg处理RTMP流媒体的命令和发送流媒体的命令(UDP,RTP,RTMP)