123456789101112131415161718192021222324252627 |
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int P = scanner.nextInt();
- int Q = scanner.nextInt();
- int N = scanner.nextInt();
- double res = 0.0;
- int p1 = 0;
- // E(X + Y) = E(X) + E(Y)
- // Getting the ith item is independent!
- for (int i = 0; i < N; i++) {
- if (8 <= i) p1 = 0;
- else p1 = P / (int) Math.pow(2, i);
- double p2 = 1.0;
- for (int j = 1; j <= 100; j++) {
- res += p1 / 100.0 * p2 * j;
- if (p1 == 100) break;
- p2 *= 1.0 - p1 / 100.0;
- p1 = p1 + Q > 100 ? 100 : p1 + Q;
- }
- }
- System.out.printf("%.2f", res);
- scanner.close();
- }
- }
|