結果

問題 No.268 ラッピング(Easy)
ユーザー itezpaceitezpace
提出日時 2016-09-12 08:51:43
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 563 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 66,164 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-10 19:01:21
合計ジャッジ時間 1,532 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
int main(){
  int l1,l2,l3,r,b,y;
  cin>>l1>>l2>>l3;
  cin>>r>>b>>y;
  vector<int> v;
  v.push_back(r);
  v.push_back(b);
  v.push_back(y);
  int x=INT_MAX;
  for(int i=0; i<3; ++i){
    rotate(v.begin(),v.begin()+1,v.end());
    int a=v[0];
    int b=v[1];
    int c=v[2];
    int y=2*(l1+l2)*a+2*(l2+l3)*b+2*(l3+l1)*c;
    if(x>y) x=y;
    int t=b;
    b=c;
    c=t;
    y=2*(l1+l2)*a+2*(l2+l3)*b+2*(l3+l1)*c;
    if(x>y) x=y;
  }
  cout<<x<<endl;
  return 0;
}
0