結果

問題 No.549 素材合成システム
コンテスト
ユーザー WutongDeath
提出日時 2025-12-21 02:34:16
言語 C++17
(gcc 13.3.0 + boost 1.89.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 286 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 850 ms
コンパイル使用メモリ 66,684 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-12-21 02:34:20
合計ジャッジ時間 3,451 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #
raw source code

#include <iostream>

using namespace std;

int n, x, ma, ans;

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &x);
        ma = max(ma, x);
        ans += x / 2;
    }
    ans -= ma / 2;
    ans += ma;
    printf("%d\n", ans);

    return 0;
}
0