結果
問題 | No.211 素数サイコロと合成数サイコロ (1) |
ユーザー |
![]() |
提出日時 | 2017-04-30 14:43:50 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 65 ms / 1,000 ms |
コード長 | 857 bytes |
コンパイル時間 | 2,048 ms |
コンパイル使用メモリ | 74,816 KB |
実行使用メモリ | 50,592 KB |
最終ジャッジ日時 | 2024-06-25 23:31:04 |
合計ジャッジ時間 | 5,106 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); int K = Integer.parseInt(reader.readLine()); int[] primes = new int[]{2, 3, 5, 7, 11, 13}; int[] composites = new int[]{4, 6, 8, 9, 10, 12}; double totalCombinations = 36; int counter = 0; for (int i = 0; i < 6; i++) { int x = primes[i]; for (int j = 0; j < 6; j++) { int y = composites[j]; if ((K%x) == 0 && y == K / x) { counter+=1; } } } System.out.println(counter/totalCombinations); } }