UVA 11880 Ball in a Rectangle(数学+平面几何)
2013-08-23 21:19
316 查看
Input: Standard Input Output: Standard Output
� There is a rectangle on the cartesian plane, with bottom-left corner at (0,0) and top-right corner at (L,W). There is a ball centered at (x, y), with radius=R, shown below
View Code
� There is a rectangle on the cartesian plane, with bottom-left corner at (0,0) and top-right corner at (L,W). There is a ball centered at (x, y), with radius=R, shown below
#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <cmath> using namespace std; typedef long long LL; const double PI = acos(-1.0); const double EPS = 1e-4; LL L, W, x, y, R, a, v, s; int main() { //cout<<cos(PI/2)<<endl; while(cin>>L>>W>>x>>y>>R>>a>>v>>s) { if(L == 0 && W == 0 && x == 0 && y == 0 && R == 0 && a == 0 && v == 0 && s == 0) break; double nx = x + v * cos(PI * a / 180) * s, ny = y + v * sin(PI * a / 180) * s; L -= R; W -= R; while(R >= nx + EPS || nx - EPS >= L) { if(R >= nx) nx = 2 * R - nx; //if(nx >= 20 * L) nx = nx - 20 * L; if(nx >= L) nx = 2 * L - nx; } while(R >= ny + EPS || ny - EPS >= W) { if(R >= ny) ny = 2 * R - ny; if(ny >= W) ny = 2 * W - ny; } printf("%.2f %.2f\n", nx, ny); } }
View Code
相关文章推荐
- UVA 11880 (Ball in a Rectangle) 平面几何
- uva 11880 Ball in a Rectangle(计算几何)
- UVA11880 Ball in a Rectangle
- UVA 11880 Ball in a Rectanglefds
- UVA 11880 Ball in a Rectangle 几何
- 【UVALive】2145 - Lost in Space(数学)
- uva 1506 Largest Rectangle in a Histogram
- hdu 5391 Zball in Tina Town (数学)
- UVa 107 The Cat in the Hat (数学)
- uva 107 The Cat in the Hat(数学)
- toj 4608 Ball in a Rectangle
- D - Ball in a Rectangle
- UVA 107 (暑假-数学 -E - The Cat in the Hat)
- HDOJ-5391 Zball in Tina Town(数学)
- UVA - 10294 Arif in Dhaka (First Love Part 2) (置换群-polya定理- 数学推导循环节)
- UVA 11174 - Stand in a Line (数学基础+除法取模)
- 数学,乘法逆元(Stand in a Line,uva 11174)
- UVA 11174 - Stand in a Line (数学基础+除法取模)
- 数学题uva107-The Cat in the Hat
- hdu 5391 Zball in Tina Town 威尔逊定理 数学