結果

問題 No.91 赤、緑、青の石
ユーザー takatowintakatowin
提出日時 2017-01-23 01:14:20
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 526 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 23,980 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-24 20:07:23
合計ジャッジ時間 1,658 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 0 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 0 ms
4,376 KB
testcase_17 AC 0 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1 ms
4,380 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>
void sort(int* a,int* b,int* c){
  int temp;
  if(a>b){
    temp=*a;
    *a=*b;
    *b=temp;
  }
  if(b>c){
    temp=*b;
    *b=*c;
    *c=temp;
  }
}
int main(void){
  int r,g,b,n=0;
  scanf("%d %d %d",&r,&g,&b);
  sort(&r,&g,&b);
  if(r==0){
    printf("0\n");
    return 0;
  }
  n=r;
  g-=r;
  b-=r;
  r=0;
  while(g>=2){
    g-=2;
    b--;
    n++;
  }
  if(g==1){
    if(b>2){
      b-=2;
      n++;
    }
  }
  while(b>4){
    b-=4;
    n++;
  }
  printf("%d\n",n );
  return 0;
}

0