結果

問題 No.1478 Simple Sugoroku
ユーザー ks2mks2m
提出日時 2021-04-16 22:29:58
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 810 bytes
コンパイル時間 3,334 ms
コンパイル使用メモリ 73,668 KB
実行使用メモリ 62,336 KB
最終ジャッジ日時 2023-09-16 01:26:01
合計ジャッジ時間 9,509 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
49,360 KB
testcase_01 AC 41 ms
49,288 KB
testcase_02 AC 40 ms
49,584 KB
testcase_03 AC 40 ms
47,688 KB
testcase_04 AC 40 ms
49,184 KB
testcase_05 WA -
testcase_06 AC 41 ms
49,328 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 40 ms
49,388 KB
testcase_10 AC 40 ms
49,228 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 185 ms
60,020 KB
testcase_30 AC 196 ms
60,608 KB
testcase_31 AC 174 ms
60,452 KB
testcase_32 AC 187 ms
60,036 KB
testcase_33 AC 199 ms
60,220 KB
testcase_34 AC 202 ms
60,368 KB
testcase_35 AC 198 ms
60,680 KB
testcase_36 AC 186 ms
60,116 KB
testcase_37 AC 185 ms
60,112 KB
testcase_38 AC 185 ms
60,424 KB
testcase_39 AC 199 ms
59,936 KB
testcase_40 AC 194 ms
61,548 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();

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