cf gym101061H Robocon Club(简单计算几何 似乎卡精度)
来源:互联网 发布:淘宝打折软件怎么用 编辑:程序博客网 时间:2024/06/05 19:59
H. Robocon Club
time limit per test2 seconds
memory limit per test64 megabytes
Problem Description
Ahmed thought that robotics is fun so he quit ACM and joined Robocon club ! Unfortunately his first task at the Robocon Club did not go as well as he expected. He was supposed to build a robot that moves in a straight line.
The robot he had built consists of a line segment of length L with a wheel of radius R on each of it’s endpoints. He placed the robot on the x axis, such that the center of the robot was the point (0, 0) , facing the positive y axis (the left and right wheels are located on and respectively).
The two wheels started moving at the same time, however, instead of moving at the same speed, the left wheel rotated at VL revolutions per second(RPS), while the right wheel rotated at VR RPS. both wheels stopped moving after S seconds. Can you help Ahmed locate the center of his robot?
Input
The first line of the input consists of a single integer T , the number of test cases. T lines follow , each describing a test case consisting of five integers L , R , VL , VR , S . indicating the length of the robot , the radius of each wheel , the speed of the left wheel in (RPS), the speed of the right wheel in (RPS) and the duration that the robot had moved , respectively . where (1 ≤ L ≤ 100 ,1 ≤ R ≤ 100 ,0 ≤ VL ≤ 100 ,0 ≤ VR ≤ 100 , 1 ≤ S ≤ 100 ) .
Output
for each test case print two real numbers on a line separated by a space denotes the coordinates of the center of the robot rounded to three decimal places .
Example
input
4
1 1 1 1 1
7 3 2 3 2
10 1 2 1 1
4 3 2 0 1
output
0.000 6.283
-6.589 -13.682
2.865 8.817
4.000 0.000
说是计算几何还不如说是数学题,左右速度相等的时候当然就是x为零,y就是路程,不等的时候就是x轴绕左边或右边某一点为圆心转圈圈,圆心设一个半径R,用速度和L一比就算出来了。
似乎卡精度,虽然我没卡。卡了那位加了eps就过了。
#include <iostream>#include <string>#include <cstdio>#include <cmath>#include <cstring>#include <queue>#include <set>#include <algorithm>#define M 100005#define mod 1000000007#define INF -0x3f3f3f3f]#define PI acos(-1)using namespace std;struct node{ int id, liter, Max;};int main(){ int T; scanf("%d", &T); while(T--) { double l, r, vl, vr, s, R; bool flag = true; scanf("%lf %lf %lf %lf %lf", &l, &r, &vl, &vr, &s); if(vl > vr) { double t = vl; vl = vr; vr = t; flag = false; } if(vl == vr) { printf("0.000 %.3lf\n", 2. * vl * r * PI * s); } else { R = (vl * l) / (vr - vl); double de; if(!R) { de = 2. * vr * r * PI / l * s; if(flag) printf("%.3lf %.3lf\n", -(l / 2) * (1 - cos(de)), (l / 2) * sin(de)); else printf("%.3lf %.3lf\n", (l / 2) * (1 - cos(de)), (l / 2) * sin(de)); } else { de = 2. * vl * r * PI / R * s; if(flag) printf("%.3lf %.3lf\n", -(R + l / 2) * (1 - cos(de)), (R + l / 2) * sin(de)); else printf("%.3lf %.3lf\n", (R + l / 2) * (1 - cos(de)), (R + l / 2) * sin(de)); } } } return 0;}
场上1a过。
运行结果:
- cf gym101061H Robocon Club(简单计算几何 似乎卡精度)
- 简单计算几何+卡精度 New Year Table CodeForces
- 计算几何 || 精度误差
- HDU5572(计算几何+精度)
- GYM 101061 H.Robocon Club(物理)
- CF Peter and Snow Blower 简单计算几何
- 计算几何中的精度问题
- 计算几何中的精度问题
- 计算几何【4】精度问题
- URAL 2099 Space Invader 计算几何、卡精度、好题
- 【转】 计算几何中的精度问题
- 【转】计算几何中的精度问题
- 计算几何中的精度问题(转)
- 计算几何中的精度问题 (转)
- ZOJ3806 二分计算几何eps控制精度
- 【转】 计算几何中的精度问题
- ACM 计算几何中的精度问题
- 计算几何中的精度问题(转)
- 循环
- lightoj 1058 - Parallelogram Counting (几何,平行四边形)
- React中实现一个全局的参数
- jQuery中return false,e.preventDefault(),e.stopPropagation()的区别
- TODO-MVP源码解析
- cf gym101061H Robocon Club(简单计算几何 似乎卡精度)
- maven打war包到指定目录下和tomcat下
- Subsequence
- ARM_Linux_NOTE_6
- Codeforce Gym 100819P : 2015-2016 ACM-ICPC Pacific Northwest Regional Contest - P 仔细看题啊!
- 0058 连续子数组的最大和
- 我的安卓开发学习系列零:为什么选择安卓
- [狗尾续貂第三篇]Redis Sentinel
- json数据转换实例