結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 0 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 WA -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 1 ms
4,380 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:19:8: warning: passing argument 1 of ‘sort’ makes pointer from integer without a cast [-Wint-conversion]
   sort(r,g,b);
        ^
main.c:3:16: note: expected ‘int *’ but argument is of type ‘int’
 void sort(int* a,int* b,int* c){
           ~~~~~^
main.c:19:10: warning: passing argument 2 of ‘sort’ makes pointer from integer without a cast [-Wint-conversion]
   sort(r,g,b);
          ^
main.c:3:23: note: expected ‘int *’ but argument is of type ‘int’
 void sort(int* a,int* b,int* c){
                  ~~~~~^
main.c:19:12: warning: passing argument 3 of ‘sort’ makes pointer from integer without a cast [-Wint-conversion]
   sort(r,g,b);
            ^
main.c:3:30: note: expected ‘int *’ but argument is of type ‘int’
 void sort(int* a,int* b,int* c){
                         ~~~~~^

ソースコード

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