結果

問題 No.57 ミリオンダイス
ユーザー r.suzukir.suzuki
提出日時 2016-01-25 02:02:50
言語 Java
(openjdk 23)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 553 bytes
コンパイル時間 3,381 ms
コンパイル使用メモリ 74,876 KB
実行使用メモリ 54,268 KB
最終ジャッジ日時 2024-11-14 06:04:10
合計ジャッジ時間 5,667 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

class Dice{
	int[] side;
	double expectationValue = 0.0;
	
	public Dice(int i){
		side = new int[i];		
	}
	
	public void setSide(){
		for(int i = 0;i < side.length;i++){
			side[i] = i+1;
		}
		
		for(int i = 0;i < side.length;i++){
			expectationValue += (side[i] * (1 / (double)side.length));
		}
	}
}

public class No_57{
	public static void main(String[] args){
		java.util.Scanner sc = new java.util.Scanner(System.in);
		int n = sc.nextInt();
		
		Dice dice = new Dice(6);
		dice.setSide();
		
		System.out.println(dice.expectationValue * n);
	}
}
0