結果

問題 No.211 素数サイコロと合成数サイコロ (1)
ユーザー koukonko
提出日時 2015-12-16 17:43:43
言語 Java
(openjdk 23)
結果
AC  
実行時間 53 ms / 1,000 ms
コード長 595 bytes
コンパイル時間 2,131 ms
コンパイル使用メモリ 74,716 KB
実行使用メモリ 37,200 KB
最終ジャッジ日時 2024-06-25 22:46:31
合計ジャッジ時間 5,286 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
		int[] prime = { 2, 3, 5, 7, 11, 13 };
		int[] compo = { 4, 6, 8, 9, 10, 12 };
		try {

			int K = Integer.parseInt(read.readLine());

			double ans = 0;
			for (int i = 0; i < 6; ++i) {
				for (int j = 0; j < 6; ++j) {
					if (prime[i] * compo[j] == K) {
						ans += 1.0 / 36;
					}
				}
			}

			System.out.println(ans);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
0