結果

問題 No.1076 寿司打
ユーザー RISE70226821RISE70226821
提出日時 2020-08-06 17:06:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 4,071 ms
コンパイル使用メモリ 73,972 KB
実行使用メモリ 57,788 KB
最終ジャッジ日時 2023-10-21 06:09:11
合計ジャッジ時間 7,135 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
55,836 KB
testcase_01 AC 145 ms
57,656 KB
testcase_02 AC 144 ms
57,640 KB
testcase_03 AC 147 ms
57,788 KB
testcase_04 AC 145 ms
57,748 KB
testcase_05 AC 144 ms
57,748 KB
testcase_06 AC 144 ms
57,692 KB
testcase_07 AC 143 ms
57,664 KB
testcase_08 AC 148 ms
57,776 KB
testcase_09 AC 144 ms
57,768 KB
testcase_10 AC 144 ms
57,688 KB
testcase_11 AC 148 ms
57,684 KB
testcase_12 AC 141 ms
55,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		// 入力
		Scanner sc = new Scanner(System.in);
		double p = sc.nextDouble();
		
		// 期待値算出
		double exp = 0.0;
		for(int x = 1; x <= 1000; x++){
			exp += Math.pow(p,(double)x) * (1-p) * x;
		}
		
		// 出力
		System.out.println(exp);
	}
}
0