結果

問題 No.212 素数サイコロと合成数サイコロ (2)
ユーザー spacia
提出日時 2016-01-04 20:36:25
言語 Java
(openjdk 23)
結果
AC  
実行時間 50 ms / 5,000 ms
コード長 750 bytes
コンパイル時間 1,904 ms
コンパイル使用メモリ 75,704 KB
実行使用メモリ 37,736 KB
最終ジャッジ日時 2024-09-19 11:15:46
合計ジャッジ時間 2,996 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.math.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String[] line = br.readLine().split(" ");
		int p = Integer.parseInt(line[0]);
		int c = Integer.parseInt(line[1]);
		
		BigDecimal ans = BigDecimal.ONE;
		BigDecimal d1 = new BigDecimal("6.8333333333333333333");
		BigDecimal d2 = new BigDecimal("8.1666666666666666666");
		
		if (p > 0) ans = ans.multiply(d1.pow(p).setScale(15 , BigDecimal.ROUND_HALF_UP));
		if (c > 0) ans = ans.multiply(d2.pow(c).setScale(15 , BigDecimal.ROUND_HALF_UP));
		
		out(ans);
	}
}
0