結果

問題 No.851 テストケース
ユーザー GrenacheGrenache
提出日時 2019-08-09 23:37:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,584 bytes
コンパイル時間 3,621 ms
コンパイル使用メモリ 75,756 KB
実行使用メモリ 56,380 KB
最終ジャッジ日時 2023-09-26 22:09:48
合計ジャッジ時間 8,199 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,688 KB
testcase_01 AC 118 ms
55,516 KB
testcase_02 WA -
testcase_03 AC 121 ms
55,904 KB
testcase_04 AC 124 ms
55,688 KB
testcase_05 AC 118 ms
55,772 KB
testcase_06 AC 122 ms
56,132 KB
testcase_07 AC 124 ms
56,216 KB
testcase_08 AC 121 ms
56,004 KB
testcase_09 AC 122 ms
56,232 KB
testcase_10 AC 124 ms
56,380 KB
testcase_11 AC 121 ms
55,688 KB
testcase_12 AC 122 ms
56,224 KB
testcase_13 AC 119 ms
55,876 KB
testcase_14 AC 123 ms
55,688 KB
testcase_15 AC 120 ms
56,004 KB
testcase_16 AC 121 ms
55,776 KB
testcase_17 AC 115 ms
55,892 KB
testcase_18 AC 121 ms
55,840 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 124 ms
55,308 KB
testcase_22 AC 121 ms
55,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


public class Main_yukicoder851 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = Integer.parseInt(sc.nextLine());
		
		String aa = sc.nextLine();
		String[] aaa = aa.split(" ");
		if (aaa.length > 1) {
			pr.println("assert");
			return;
		}

		long[] a = new long[n];
		a[0] = Long.parseLong(aaa[0]);
		for (int i = 1; i < n; i++) {
			a[i] = sc.nextLong();
		}

		Arrays.sort(a);

		long tmp = Math.max(a[0] + a[2], a[0] + a[1]);
		if (tmp == a[1] + a[2]) {
			tmp = a[0] + a[1];
		}
		
		pr.println(tmp);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
		
		void printInts(int... a) {
			StringBuilder sb = new StringBuilder(32);
			for (int i = 0, size = a.length; i < size; i++) {
				if (i > 0) {
					sb.append(' ');
				}
				sb.append(a[i]);
			}

			println(sb);
		}
		
		void printLongs(long... a) {
			StringBuilder sb = new StringBuilder(64);
			for (int i = 0, size = a.length; i < size; i++) {
				if (i > 0) {
					sb.append(' ');
				}
				sb.append(a[i]);
			}

			println(sb);
		}
		
		void printStrings(String... a) {
			StringBuilder sb = new StringBuilder(32);
			for (int i = 0, size = a.length; i < size; i++) {
				if (i > 0) {
					sb.append(' ');
				}
				sb.append(a[i]);
			}

			println(sb);
		}
	}
}
0