結果
問題 |
No.75 回数の期待値の問題
|
ユーザー |
![]() |
提出日時 | 2015-03-13 00:51:15 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 1,147 ms / 5,000 ms |
コード長 | 427 bytes |
コンパイル時間 | 1,968 ms |
コンパイル使用メモリ | 74,168 KB |
実行使用メモリ | 41,916 KB |
最終ジャッジ日時 | 2024-06-28 22:45:32 |
合計ジャッジ時間 | 9,635 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
import java.beans.IntrospectionException; import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int ans=0; for(int i=0;i<200000;i++){ int count=0; int now=0; while(true){ now+=(int)(Math.random()*6)+1; count++; if(now==n) break; if(now>n) now=0; } ans+=count; } System.out.println(ans*1.0/200000); } }