結果

問題 No.851 テストケース
ユーザー toyamatoyama
提出日時 2019-07-26 21:43:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 632 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 64,080 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-15 00:56:46
合計ジャッジ時間 1,607 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 WA -
testcase_22 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
using namespace std;
using ll = long long;

int main()
{
    ll n;
    ll a[3];
    ll line = 0;

    scanf("%lld", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lld", a + i); 
        char ch = getchar();

        if (ch == ' ') {
            puts("\"assert\"");
            return 0;
        }
    }

    ll max1 = 0, max2 = 0;

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {

            if (max1 < a[i] + a[j]) {
                max2 = max1;
                max1 = a[i] + a[j];
            }
        }
    }

    cout << max2 << endl;

    return 0;
}
0