結果

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

テストケース

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

ソースコード

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;
  }
  if(*a>*b){
    temp=*a;
    *a=*b;
    *b=temp;
  }
}
int main(void){
  int r,g,b,n=0,i=0,temp;
  scanf("%d %d %d",&r,&g,&b);
  sort(&r,&g,&b);
  //printf("%d %d %d",r,g,b);

  n=r;
  g-=r;
  b-=r;
  temp=(b-g)/2;
  n+=temp;
  b-=temp*2;
  b-=temp;
  g-=temp;
  while((g>=3 || b>=3) && b>0 && g>0){
    if(i%2==0){
      n++;
      g-=3;
      b--;
    }else{
      n++;
      g--;
      b-=3;
    }
    i++;
  }
  printf("%d\n",n);
  return 0;
}

0