結果

問題 No.549 素材合成システム
ユーザー dsytk7
提出日時 2017-07-28 22:37:08
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 1,271 ms
コンパイル使用メモリ 164,124 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-10 05:14:37
合計ジャッジ時間 3,414 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair< int, int >;

int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    rep(i, n) cin >> x[i];
    sort(x.begin(), x.end());
    reverse(x.begin(), x.end());

    ll sum = 0;
    sum = x[0] + floor(x[1]/2.0);
    for (int i=2; i<n; ++i) {
        sum += floor(x[i]/2.0);
    }
    cout << sum << endl;
}
0