結果

問題 No.1883 SLASH
ユーザー mamo_ICEmamo_ICE
提出日時 2022-12-28 21:09:57
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 840 bytes
コンパイル時間 888 ms
コンパイル使用メモリ 23,308 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-15 15:40:32
合計ジャッジ時間 2,130 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 0 ms
4,376 KB
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 0 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:5: warning: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration]
     gets(str);
     ^~~~
     fgets
/tmp/ccuwJDkx.o: In function `main':
main.c:(.text.startup+0xc): warning: the `gets' function is dangerous and should not be used.

ソースコード

diff #

#include <stdio.h>
#define toi(c) (c-'0')

int main(void){
    char str[4];
    int max, min;
    
    gets(str);
    if(str[0] < str[1])
        if(str[1] < str[2]){  // str[0] < str[1] < str[2]
            min = 0;
            max = 2;
        }else if(str[0] < str[2]){  // str[0] < str[2] < str[1]
            min = 0;
            max = 1;
        }else{  // str[2] < str[0] < str[1]
            min = 2;
            max = 1;
        }
    else  // str[1] < str[0]
        if(str[0] < str[2]){  // str[1] < str[0] < str[2]
            min = 1;
            max = 2;
        }else if(str[1] < str[2]){  // str[1] < str[2] < str[0]
            min = 1;
            max = 0;
        }else{  // str[2] < str[1] < str[0]
            min = 2;
            max = 0;
        }
    printf("%d\n", toi(str[max])-toi(str[min]));
    
    return 0;
}
0