結果

問題 No.1478 Simple Sugoroku
ユーザー ks2mks2m
提出日時 2021-04-16 22:32:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 210 ms / 2,000 ms
コード長 803 bytes
コンパイル時間 1,863 ms
コンパイル使用メモリ 73,736 KB
実行使用メモリ 61,028 KB
最終ジャッジ日時 2023-09-16 01:31:12
合計ジャッジ時間 9,580 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
49,484 KB
testcase_01 AC 41 ms
49,016 KB
testcase_02 AC 41 ms
49,096 KB
testcase_03 AC 41 ms
49,016 KB
testcase_04 AC 41 ms
49,088 KB
testcase_05 AC 40 ms
49,304 KB
testcase_06 AC 39 ms
49,008 KB
testcase_07 AC 41 ms
49,052 KB
testcase_08 AC 42 ms
48,992 KB
testcase_09 AC 41 ms
48,956 KB
testcase_10 AC 39 ms
49,012 KB
testcase_11 AC 41 ms
49,080 KB
testcase_12 AC 40 ms
49,036 KB
testcase_13 AC 202 ms
58,372 KB
testcase_14 AC 210 ms
60,048 KB
testcase_15 AC 195 ms
60,172 KB
testcase_16 AC 198 ms
59,616 KB
testcase_17 AC 196 ms
60,520 KB
testcase_18 AC 202 ms
61,028 KB
testcase_19 AC 203 ms
59,712 KB
testcase_20 AC 196 ms
60,688 KB
testcase_21 AC 205 ms
60,520 KB
testcase_22 AC 200 ms
60,080 KB
testcase_23 AC 202 ms
60,512 KB
testcase_24 AC 208 ms
60,160 KB
testcase_25 AC 196 ms
60,444 KB
testcase_26 AC 201 ms
60,104 KB
testcase_27 AC 198 ms
60,756 KB
testcase_28 AC 188 ms
60,420 KB
testcase_29 AC 195 ms
60,148 KB
testcase_30 AC 191 ms
59,980 KB
testcase_31 AC 194 ms
60,224 KB
testcase_32 AC 189 ms
60,192 KB
testcase_33 AC 194 ms
59,972 KB
testcase_34 AC 181 ms
60,144 KB
testcase_35 AC 199 ms
60,516 KB
testcase_36 AC 189 ms
60,236 KB
testcase_37 AC 195 ms
60,260 KB
testcase_38 AC 202 ms
60,216 KB
testcase_39 AC 195 ms
60,692 KB
testcase_40 AC 192 ms
60,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int m = Integer.parseInt(sa[1]);

		sa = br.readLine().split(" ");
		int[] b = new int[m];
		for (int i = 0; i < m; i++) {
			b[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		double e = b[m - 1] - b[0];
		long sum = 0;
		int cnt = 0;
		for (int i = m - 1; i >= 0; i--) {
			int d = b[m - 1] - b[i];
			sum += d;
			cnt++;
			double e1 = (double) m / cnt;
			double e2 = (double) sum / cnt;
			e = Math.min(e, e1 + e2);
		}
		double ans = b[0] - 1 + e + n - b[m - 1];
		System.out.println(ans);
	}
}
0