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 ...
随机推荐
- hd acm2045
LELE的RPG难题 析: 假设有N个方格时的涂法是F[N]种.当前边n-1个方格成立时,再加第n种颜色无影响,此时有F[N-1]种涂法,当n-1个方格违法时,即有两个相邻的格子颜色相同,则有n-2个 ...
- PyVmomi Clone_VM with CustomizaitonSpec
调用CustomizaitonSpec来Clone VM ''' Created on 2017-09-03 @author: Vincen ''' from pyVmomi import vim f ...
- WebSocket实现Web聊天室
一.客户端: JS代码如下: /* * 这部分js将websocket封装起来 */ var websocket = null; //判断当前浏览器是否支持WebSocket if ('WebSock ...
- Luogu-2657 [SCOI2009]windy数
很少做数位\(dp\)的题,做道题学习一下吧. 记忆化搜索,\(f[10][10][2][2]\)分别记录当前位置,上一位数,是否有前导零和是否有大小上限. 题目要满足相邻两个数相差不小于2,如果有前 ...
- 日期工具类 DateUtils(继承org.apache.commons.lang.time.DateUtils类)
/** * */ package com.dsj.gdbd.utils.web; import org.apache.commons.lang3.time.DateFormatUtils; impor ...
- jmeter--简单使用
1.启动jmeter 2.创建线程组 2.点击线程组,选择添加,选择sampler(采样器),选择http请求 3.在添加的请求页面中,填写服务器名称或IP,端口,路径,请求的方法 4.添加请求的参数 ...
- 重拾安卓_01_安卓开发环境搭建(eclipse)
一.下载安装Android SDK 1.下载地址 (1)官网(可FQ选择):http://developer.android.com/sdk/index.html (2)不可FQ选择:http://w ...
- Git_错误_02_error: src refspec master does not match any
现象:在一个目录下初始化仓库之后,就开始push到github,结果出现了这个错误. 错因:初始化仓库之后,并没有使用git add,git commit 命令将文件添加到git仓库中,所以仓库为空, ...
- 关键字volidate和transient(转)
Volatile修饰的成员变量在每次被线程访问时,都强迫从主内存中重读该成员变量的值.而且,当成员变量发生变化时,强迫线程将变化值回写到主内存.这样在任何时刻,两个不同的线程总是看到某个成员变量的同一 ...
- ADO:连接,执行语句与关闭(sql server数据库)
一,身份验证: sql server数据库连接身份验证有两种:windows身份验证和SQL Server身份验证 windows验证:是使用windows的安全子系统对用户连接进行有效性验证.(个人 ...