結果

問題 No.851 テストケース
ユーザー ks2m
提出日時 2019-07-26 21:32:44
言語 Java
(openjdk 23)
結果
AC  
実行時間 56 ms / 3,153 ms
コード長 788 bytes
コンパイル時間 2,071 ms
コンパイル使用メモリ 77,408 KB
実行使用メモリ 37,452 KB
最終ジャッジ日時 2024-07-02 06:41:59
合計ジャッジ時間 4,152 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

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]);
		long[] a = new long[n];
		sa = br.readLine().split(" ");
		if (sa.length > 1) {
			System.out.println("\"assert\"");
			return;
		}
		a[0] = Long.parseLong(sa[0]);
		a[1] = Long.parseLong(br.readLine());
		a[2] = Long.parseLong(br.readLine());

		long[] b = new long[n];
		b[0] = a[0] + a[1];
		b[1] = a[0] + a[2];
		b[2] = a[1] + a[2];
		Arrays.parallelSort(b);
		if (b[1] == b[2]) {
			System.out.println(b[0]);
		} else {
			System.out.println(b[1]);
		}
	}
}
0