結果
問題 | No.851 テストケース |
ユーザー | Grenache |
提出日時 | 2019-08-09 23:38:30 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 130 ms / 3,153 ms |
コード長 | 1,588 bytes |
コンパイル時間 | 3,482 ms |
コンパイル使用メモリ | 75,884 KB |
実行使用メモリ | 56,456 KB |
最終ジャッジ日時 | 2023-09-26 22:10:11 |
合計ジャッジ時間 | 7,492 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 126 ms
55,908 KB |
testcase_01 | AC | 127 ms
56,076 KB |
testcase_02 | AC | 126 ms
55,444 KB |
testcase_03 | AC | 126 ms
55,984 KB |
testcase_04 | AC | 127 ms
56,096 KB |
testcase_05 | AC | 127 ms
56,424 KB |
testcase_06 | AC | 127 ms
56,104 KB |
testcase_07 | AC | 128 ms
55,684 KB |
testcase_08 | AC | 127 ms
56,292 KB |
testcase_09 | AC | 128 ms
55,720 KB |
testcase_10 | AC | 126 ms
55,724 KB |
testcase_11 | AC | 127 ms
56,208 KB |
testcase_12 | AC | 125 ms
55,956 KB |
testcase_13 | AC | 126 ms
56,380 KB |
testcase_14 | AC | 127 ms
56,000 KB |
testcase_15 | AC | 125 ms
53,992 KB |
testcase_16 | AC | 128 ms
56,092 KB |
testcase_17 | AC | 127 ms
56,236 KB |
testcase_18 | AC | 122 ms
55,856 KB |
testcase_19 | AC | 120 ms
56,456 KB |
testcase_20 | AC | 123 ms
55,952 KB |
testcase_21 | AC | 130 ms
56,232 KB |
testcase_22 | AC | 128 ms
55,964 KB |
ソースコード
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); } } }