結果
問題 | No.268 ラッピング(Easy) |
ユーザー |
![]() |
提出日時 | 2015-08-21 23:19:30 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 765 bytes |
コンパイル時間 | 553 ms |
コンパイル使用メモリ | 63,960 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 12:10:08 |
合計ジャッジ時間 | 1,142 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
/*→、手前から奥、↓の順にL1, L2, L3の長さを持つとする。 3つのリボンの長さ: ・2(L2 + L3) ・2(L1 + L3) ・2(L1 + L2) (リボンの色は自由に変更できる) ・周回数が多いものほど影響力が強い→そういうのは1周が短い周に使う方がよい。*/ #include<iostream> #include<algorithm> #include<functional> using namespace std; int size[3]; int l[3], r[3]; int main() { for( int i = 0; i < 3; i++ ) cin >> size[i]; for( int i = 0; i < 3; i++ ) cin >> r[i]; for( int i = 0; i < 3; i++ ) l[i] = 2 * (size[i] + size[(i+1)%3]); sort(l, l+3); sort(r, r+3, greater<int>()); int sumLen = 0; for( int i = 0; i < 3; i++ ){ sumLen += l[i] * r[i]; } cout << sumLen << endl; return 0; }