题意:你从开始坐标到末尾坐标,要经过 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. CF778A:String Game

    给出字符串s和t,以及s的长度n的一个全排列,求按照这个排列依次删除s的字符,删到何时s中不含子序列t. 解法一: t中的每个字符的位置在s中跳啊跳,合法的情况下t中的字符在s中的位置应该是单调递增的 ...

  2. poj2243+poj1915骑士问题

    2243是骑士问题,八个格子的,BFS,因为要最短路经,所以没有用A*,A*跑不出来,太慢了,因为要搜索到所有解啊!一直更新最优,而BFS,一层一层搜索,第一次得到的便是最短的了!300格子,标记的话 ...

  3. python学习之-- shutil模块

    shutil 模块功能:文件/文件夹的复制,压缩处理模块shutil.copyfileobj(fsrc,fdst[,length]):将文件内容拷贝到另一个文件中,也可以是部分内容举例:文件复制 im ...

  4. POJ 1062 【带约束的最短路问题】

    中文题题意不写. 建图: 我自己想到的建图方式是把每个物品看作两个点,编号分别是i和i+n,然后每个物品两个点之间边的权值是物品本身的价值.然后从第i个点往外连边,目标是可替代品顶点编号较小的点,权值 ...

  5. 收集的一些Redis操作技巧教程

    redis(1).redis入门 redis(2).redis数据类型 redis(3).基于jedis.spring-data-redis 连接操作redis redis(4).基于redis 构建 ...

  6. 【转载】《Unix网络编程》思维导图

    参考这篇文章,很不错: http://www.cnblogs.com/qiaoconglovelife/p/5734768.html

  7. [转]thrift系列 - 快速入门

    原文: http://blog.csdn.net/hrn1216/article/details/51274934 thrift 介绍,入门例子. thrift 是一个RPC框架,实现跨语言 ---- ...

  8. curl的使用(from 阮一峰)

    1.   http://www.ruanyifeng.com/blog/2011/09/curl.html 2.   https://curl.haxx.se/docs/httpscripting.h ...

  9. android多个fragment返回键层层返回

    在FragmentActivity的fragment跳转的时候加入到执行栈. public void switchFrag(BaseFragment to) { getSupportFragmentM ...

  10. sdk manager 创建的虚拟机启动的时候总是在Android字样解决

    一直显示Android字样.仅仅须要删除文件夹下的snapshots.img 找到sdk的文件夹下的\tools\lib\emulator,然后删除上面的文件snapshots.img就可以,我的sd ...