結果
| 問題 |
No.268 ラッピング(Easy)
|
| コンテスト | |
| ユーザー |
notetonous
|
| 提出日時 | 2016-04-15 17:33:55 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 517 bytes |
| コンパイル時間 | 134 ms |
| コンパイル使用メモリ | 21,632 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-04 10:06:38 |
| 合計ジャッジ時間 | 649 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:19: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | for(i=0;i<3;i++)scanf("%d",&l[i]);
| ^~~~~~~~~~~~~~~~~
main.c:11:19: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | for(i=0;i<3;i++)scanf("%d",&r[i]);
| ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(){
int l[3];
int r[3];
int L[3];
int i,j;
int tmp;
int ans=0;
for(i=0;i<3;i++)scanf("%d",&l[i]);
for(i=0;i<3;i++)scanf("%d",&r[i]);
L[0]=l[0]+l[1];
L[1]=l[1]+l[2];
L[2]=l[2]+l[0];
for(i=0;i<3;i++){
for(j=2;j>i;j--){
if(L[j]<L[j-1]){
tmp=L[j];
L[j]=L[j-1];
L[j-1]=tmp;
}
if(r[j]<r[j-1]){
tmp=r[j];
r[j]=r[j-1];
r[j-1]=tmp;
}
}
}
ans=2*L[0]*r[2]+2*L[1]*r[1]+2*L[2]*r[0];
printf("%d\n",ans);
return 0;
}
notetonous