結果

問題 No.268 ラッピング(Easy)
ユーザー akakimidoriakakimidori
提出日時 2017-06-08 23:03:49
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 461 bytes
コンパイル時間 913 ms
コンパイル使用メモリ 21,776 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-23 19:55:51
合計ジャッジ時間 1,611 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 0 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 0 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 0 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘run’:
main.c:20:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |   scanf("%d%d%d",l,l+1,l+2);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
main.c:21:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |   scanf("%d%d%d",r,r+1,r+2);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

void sort(int *a,int n){
  int i,j;
  for(i=1;i<n;i++){
    int p=a[i];
    j=i-1;
    while(j>=0 && a[j]>p){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=p;
  }
  return;
}

void run(void){
  int l[3];
  int r[3];
  scanf("%d%d%d",l,l+1,l+2);
  scanf("%d%d%d",r,r+1,r+2);

  sort(l,3);
  sort(r,3);
  int ans=2*(l[0]*(r[2]+r[1])+l[1]*(r[2]+r[0])+l[2]*(r[0]+r[1]));
  printf("%d\n",ans);
  return;
}

int main(void){
  run();
  return 0;
}
0