結果
| 問題 |
No.1883 SLASH
|
| コンテスト | |
| ユーザー |
mamo_ICE
|
| 提出日時 | 2022-12-28 21:09:57 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 840 bytes |
| コンパイル時間 | 716 ms |
| コンパイル使用メモリ | 20,608 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-23 23:23:46 |
| 合計ジャッジ時間 | 1,592 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:5: warning: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration]
8 | gets(str);
| ^~~~
| fgets
/usr/bin/ld: /tmp/ccV0LONm.o: in function `main':
main.c:(.text.startup+0x1e): 警告: the `gets' function is dangerous and should not be used.
ソースコード
#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;
}
mamo_ICE