結果

問題 No.211 素数サイコロと合成数サイコロ (1)
ユーザー kenji_shioya
提出日時 2016-06-11 18:15:15
言語 Java
(openjdk 23)
結果
AC  
実行時間 158 ms / 1,000 ms
コード長 734 bytes
コンパイル時間 3,431 ms
コンパイル使用メモリ 76,844 KB
実行使用メモリ 41,888 KB
最終ジャッジ日時 2024-06-25 23:00:40
合計ジャッジ時間 9,388 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
//import java.text.*;

public class Exercise77{
  public static void main (String[] args){

    //DecimalFormat df = new DecimalFormat("#.############");
    Scanner sc = new Scanner(System.in);

    double n = sc.nextDouble();

    double[] pDice = new double[]{2, 3, 5, 7, 11, 13};
    double[] cDice = new double[]{4, 6, 8, 9, 10, 12};

    double count = 0;

    for (int i = 0; i < pDice.length; i++){
      if (n % pDice[i] != 0){
        continue;
      }
      double devided = n / pDice[i];
      for (int j = 0; j < cDice.length; j++){
        if (devided == cDice[j]){
          count++;
        }else{
        }
      }
    }
    System.out.println(count / (double)(pDice.length * cDice.length));
  }
}
0