結果
問題 |
No.549 素材合成システム
|
ユーザー |
|
提出日時 | 2019-01-31 13:26:18 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 806 bytes |
コンパイル時間 | 541 ms |
コンパイル使用メモリ | 62,656 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-14 06:26:08 |
合計ジャッジ時間 | 3,264 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
ソースコード
#include <iostream> #include <vector> #include <map> #include <array> using namespace std; template<class T> bool maxPointer(T& a, T b) { if (a < b) {a = b;return true;}return false;} template<class T> int maxReturn(T a, T b) {if (a > b) {return a;} else {return b;}} template<class T> bool minPointer(T& a, T b) {if (a < b) {a = b;return true;}return false;} int main(void){ int N,max=0,maxIndex=0,ans=0; cin >> N; int array[N]; for (int i = 0; i < N; i++) { cin >> array[i]; if (array[i] > max) { max = array[i]; maxIndex = i; } } for (int i = 0; i < N; i++) { if (maxIndex != i) { ans += array[i] / 2; } else { ans += array[i]; } } cout << ans << endl; }