|
|
back to boardMay program responds correctly. but why that's answered me Runtime error why? In JAVA 1.7 import java.util.Scanner; public class _1011 { public static void main(String[] args) throws Exception { Scanner s = new Scanner(System.in); double p, q; p = Double.parseDouble(s.nextLine()); q = Double.parseDouble(s.nextLine()); p /= 100; q /= 100; answer(p, q, 1, 1, 0); } public static void answer(double p, double q, double m, double mp, long n) { long t = (long) (m / q) + 1; if (p * t < mp) { System.out.println(n + t); } else { answer(p, q, 1 - q * t + m, 1 - p * t + mp, n + t); } } } |
|
|