题意:你从开始坐标到末尾坐标,要经过 k 秒,然后给你每秒的风向,和飞机的最大速度,问能不能从开始到末尾。

析:首先这个风向是不确定的,所以我们先排除风向的影响,然后算出,静风是的最小速度,如果这都大于最大速度,肯定是不可能,如果可能,

再计算出每秒走的单位长度,然后再模拟整个过程。

代码如下:

#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>
#define debug puts("+++++")
//#include <tr1/unordered_map>
#define freopenr freopen("in.txt", "r", stdin)
#define freopenw freopen("out.txt", "w", stdout)
using namespace std;
//using namespace std :: tr1; typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f;
const LL LNF = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 1e4 + 5;
const LL mod = 1e3 + 7;
const int N = 1e6 + 5;
const int dr[] = {-1, 0, 1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1};
const char *Hex[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
inline LL gcd(LL a, LL b){ return b == 0 ? a : gcd(b, a%b); }
inline int gcd(int a, int b){ return b == 0 ? a : gcd(b, a%b); }
inline int lcm(int a, int b){ return a * b / gcd(a, b); }
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 int Min(int a, int b){ return a < b ? a : b; }
inline int Max(int a, int b){ return a > b ? a : b; }
inline LL Min(LL a, LL b){ return a < b ? a : b; }
inline LL Max(LL a, LL b){ return a > b ? a : b; }
inline bool is_in(int r, int c){
return r >= 0 && r < n && c >= 0 && c < m;
}
int t[maxn];
double x[maxn], y[maxn]; int main(){
freopen("joy.in", "r", stdin);
freopen("joy.out", "w", stdout);
int sx, sy, fx, fy;
while(scanf("%d %d %d %d", &sx, &sy, &fx, &fy) == 4){
int k;
scanf("%d %d %d", &n, &k, &m);
for(int i = 1; i <= n; ++i) scanf("%d %lf %lf", &t[i], &x[i], &y[i]);
t[n+1] = k;
double dx = fx - sx;
double dy = fy - sy;
for(int i = 1; i <= n; ++i){
dx -= x[i] * (t[i+1] - t[i]);
dy -= y[i] * (t[i+1] - t[i]);
}
if(hypot(dx, dy) > (double)m * k){
puts("No"); continue;
}
puts("Yes");
double vx = dx / k;
double vy = dy / k;
int pos = 0;
double ansx = sx;
double ansy = sy;
for(int i = 1; i <= k; ++i){
if(t[pos+1] < i) ++pos;
ansx += x[pos] + vx;
ansy += y[pos] + vy;
printf("%f %f\n", ansx, ansy);
}
}
return 0;
}

Gym 100531J Joy of Flight (几何)的更多相关文章

  1. Codeforces Gym 100531J Joy of Flight 变换坐标系

    Joy of Flight 题目连接: http://codeforces.com/gym/100531/attachments Description Jacob likes to play wit ...

  2. gym 101081 E. Polish Fortress 几何

    E. Polish Fortress time limit per test 2.0 s memory limit per test 256 MB input standard input outpu ...

  3. Why We Worry and What to Do About It

    Note: My new book Atomic Habits is available to preorder now. Click here to learn more. The Evolutio ...

  4. codeforces Gym 100187B B. A Lot of Joy

    B. A Lot of Joy Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/proble ...

  5. Codeforces Gym 100269F Flight Boarding Optimization 树状数组维护dp

    Flight Boarding Optimization 题目连接: http://codeforces.com/gym/100269/attachments Description Peter is ...

  6. 【Gym - 101124A】The Baguette Master (数学,几何)

    BUPT2017 wintertraining(15) #4F Gym - 101124A 题意 给定画框宽度,画的四边和一个对角线长度,求画框外沿周长. 题解 过顶点做画框的垂线,每个角都得到两个全 ...

  7. Gym - 100269F Flight Boarding Optimization(dp+树状数组)

    原题链接 题意: 现在有n个人,s个位置和你可以划分长k个区域你可以把s个位置划分成k个区域,这样每个人坐下你的代价是该区域内,在你之前比你小的人的数量问你怎么划分这s个位置(当然,每个区域必须是连续 ...

  8. On the way to the park Gym - 101147I 几何

    http://codeforces.com/gym/101147/problem/I I. On the way to the park time limit per test 5 seconds m ...

  9. Gym 100187B-A Lot of Joy

    题意:给一个字符串,将每个字符分开放进两个口袋,每次从两个口袋分别拿出一个字符,如果相同则开心,问开心的次数期望是多少. 分析:数学期望题,然而这是我最不拿手的...最后答案是每个字符在字符串出现的次 ...

随机推荐

  1. EsAlert

    https://www.cnblogs.com/zhaishaomin/p/7417306.html https://blog.csdn.net/pujiaolin/article/details/5 ...

  2. HDU 1669 二分图多重匹配+二分

    Jamie's Contact Groups Time Limit: 15000/7000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/ ...

  3. 最短路——Dijkstra算法

    模板 水模板ing #include <cstdio> #include <cstring> #include <algorithm> #include <i ...

  4. 几道hash题

    1: UVa 10887 - Concatenation of Languages map 可以做 ,但是输入实在恶心,有空串之类的HASH模板: int Hash(char *s){   int s ...

  5. 洛谷 P3811 【模板】乘法逆元

    P3811 [模板]乘法逆元 题目背景 这是一道模板题 题目描述 给定n,p求1~n中所有整数在模p意义下的乘法逆元. 输入输出格式 输入格式: 一行n,p 输出格式: n行,第i行表示i在模p意义下 ...

  6. maven之发布项目到nexus【clean deploy命令】

    原文:http://m.blog.csdn.net/article/details?id=49667971 当我们的项目开发完成以后,可能要进行发布(如果是独立的项目,就不需要发布啦,如果是模块项目, ...

  7. IntelliJ IDEA14.0.3+Maven+SpringMVC+Spring+Hibernate光速构建Java权限管理系统(三)

    注册登录 --利用简单的编写注册登录系统来打通从前端到后台的数据传输路径. 一.建立数据库.基本表 基本环境:mysql5,7.Navicat for MySQL11.0.9企业版. 我们在本地MyS ...

  8. Github配置SSH

    以前也配置过ssh,但是没有注意用法,在配置一次熟悉流程 检查本机是否有ssh key设置 $ cd ~/.ssh 或cd .ssh 如果没有则提示: No such file or director ...

  9. 报错** is not accessible due to restriction on required library

    报错: Description Resource Path Location TypeAccess restriction: The type Map<String,Object> is ...

  10. Java静态分派与动态分派(二)

    方法调用并不等于方法执行,方法调用阶段唯一的任务就是确定被调用方法的版本(即调用哪一个方法),暂时还不涉及方法内部的具体运行过程. 在程序运行时,进行方法调用是最普遍.最频繁的操作,但是Class文件 ...