結果

問題 No.268 ラッピング(Easy)
ユーザー y_mazun
提出日時 2015-08-21 22:28:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 523 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 52,672 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 11:36:10
合計ジャッジ時間 899 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int getInt()’:
main.cpp:5:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 | inline int getInt(){ int s; scanf("%d", &s); return s; }
      |                             ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <queue>
#include <set>

using namespace std;

int main(){
  vector<int> l(3);
  vector<int> a(3);

  REP(i,3) l[i] = getInt();
  REP(i,3) a[i] = getInt();

  vector<int> k(3);
  REP(i,3) k[i] = l[0] + l[1] + l[2] - l[i];

  sort(a.begin(), a.end());
  sort(k.rbegin(), k.rend());

  int ans = 0;
  REP(i,3) ans += 2 * a[i] * k[i];
  printf("%d\n", ans);

  return 0;
}
0