結果

問題 No.549 素材合成システム
ユーザー aaa
提出日時 2018-09-23 20:00:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 1,195 ms
コンパイル使用メモリ 99,880 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 13:44:29
合計ジャッジ時間 3,862 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>

using namespace std;


int main() {
	int i, j, k;
	int n;
	vector<long>x;

	cin >> n;


	for (i = 0; i < n; i++) {
		long num;
		cin >> num;
		x.push_back(num);
	}
	
	sort(x.begin(), x.end());
	long num = 0;

	for (i = 0; i < n - 1; i++) {
		/*
		if (i == 0) {
			num += x[i + 1] + x[i] / 2;
			i++;
			continue;
		}*/

		/*
		if (num < x[i]) {
			x[i] += num / 2;
			num = x[i];
		}
		else if (num > x[i]) {
			num += x[i] / 2;
		}*/

		x[n - 1] += x[i] / 2;

		num = x[n - 1];
	}


	cout << num << endl;






	getchar();
	getchar();
	return 0;
}
0