解题思路:
注意事项:
参考代码:
import java.util.Scanner; public class Main { public static double f(double s, double d, double l) { if (s <= l - d) return s + d; else { s = s - (l - d); int a = (int) (s / l); if (a % 2 != 0) return s - (l * a); else { return l - (s - (l * a)); } } } public static double f1(double s, double d, double l) { if (s <= d) return d - s; else { s = s - d; int a = (int) (s / l); if (a % 2 != 0) { return l - (s - (l * a)); } else { return s - (l * a); } } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { double l = sc.nextDouble(); double w = sc.nextDouble(); double x = sc.nextDouble(); double y = sc.nextDouble(); double r = sc.nextDouble(); double a = sc.nextDouble(); double v = sc.nextDouble(); double s = sc.nextDouble(); if (l == 0 && w == 0) break; else { l = l - 2 * r; w = w - 2 * r; x = x - r; y = y - r; double t = a; a = Math.toRadians(a); double sx = Math.abs(v * Math.cos(a) * s); double sy = Math.abs(v * Math.sin(a) * s); if (t <= 90) { x = f(sx, x, l) + r; y = f(sy, y, w) + r; } else if (t <= 180) { x = f1(sx, x, l) + r; y = f(sy, y, w) + r; } else if (t <= 270) { x = f1(sx, x, l) + r; y = f1(sy, y, w) + r; } else { x = f(sx, x, l) + r; y = f1(sy, y, w) + r; } } System.out.printf("%.2f %.2f\n",x,y); } } }
0.0分
1 人评分