解题思路:
注意事项:解析请看这里: https://blog.dotcpp.com/a/63859
参考代码:
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
int L, W; // 台球桌长宽
int x, y, R; // 初始球心位置和台球半径
int a, v, s; // 初始角度,速度,经过时间
double resX, resY; // 最终球心位置
while (cin >> L >> W >> x >> y >> R >> a >> v >> s)
{
if (!L) break;
//构造新的台球桌
L -= 2 * R;
W -= 2 * R;
x -= R;
y -= R;
double arc = a * acos(-1) / 180; // 正确的角度转弧度,公式
// 球距离原点的总位移,必须取绝对值
double length = abs(x + v * s * cos(arc));
double width = abs(y + v * s * sin(arc));
// 每移动2L实际坐标没变
while (length > 2 * L ) { length -= 2 * L; }
while (width > 2 * W) { width -= 2 * W; }
if (length <= L) { resX = length + R; }
else { resX = 2 * L - length + R; }
if (width <= W) { resY = width + R; }
else{ resY = 2 * W - width + R;}
cout << fixed << setprecision(2) << resX << " " << resY << endl;
}
return 0;
}
0.0分
1 人评分
C语言考试练习题_排列 (C语言代码)浏览:1326 |
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:1450 |
字符串比较 (C语言代码)答案错误????浏览:597 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:592 |
求组合数 (C语言代码)浏览:1159 |
【排队买票】 (C语言代码)浏览:900 |
简单的for循环浏览:1410 |
【计算球体积】 (C语言代码)浏览:1103 |
字符逆序 (C语言代码)浏览:617 |
循环入门练习5 (C语言代码)浏览:839 |