結果

問題 No.91 赤、緑、青の石
コンテスト
ユーザー takatowin
提出日時 2017-01-23 01:42:03
言語 C90(gcc15)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 638 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 289 ms
コンパイル使用メモリ 37,176 KB
最終ジャッジ日時 2026-02-24 00:07:24
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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