結果
問題 | No.3032 Unavailability of Inequality Signs |
ユーザー | はむ吉🐹 |
提出日時 | 2018-02-04 17:59:41 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 646 bytes |
コンパイル時間 | 218 ms |
コンパイル使用メモリ | 28,288 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 04:00:16 |
合計ジャッジ時間 | 1,016 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | AC | 1 ms
6,944 KB |
testcase_02 | AC | 1 ms
6,940 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 0 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | AC | 1 ms
6,944 KB |
testcase_08 | AC | 1 ms
6,940 KB |
testcase_09 | AC | 1 ms
6,944 KB |
コンパイルメッセージ
main.c: In function 'compare': main.c:9:26: warning: implicit declaration of function 'abs' [-Wimplicit-function-declaration] 9 | return (a - b) / abs(a - b); | ^~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'abs' +++ |+#include <stdlib.h> 1 | /* #include ... は省略できる */ main.c: In function 'main': main.c:16:5: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 16 | scanf("%d\n", &n); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | /* #include ... は省略できる */ main.c:16:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 16 | scanf("%d\n", &n); | ^~~~~ main.c:16:5: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:22:13: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 22 | printf("%c\n", 62); | ^~~~~~ main.c:22:13: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:22:13: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:22:13: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:24:13: warning: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 24 | puts("="); | ^~~~ main.c:24:13: note: include '<stdio.h>' or provide a declaration of 'puts' main.c:26:13: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] 26 | printf("%c\n", 60); | ^~~~~~ main.c:26:13: note: include '<stdio.h>' or provide a declaration of 'printf'
ソースコード
/* #include ... は省略できる */ /* 絶対値を用いて大小比較を行う */ int compare(int a, int b){ if (a == b) { return 0; } else { return (a - b) / abs(a - b); } } int main() { int n; scanf("%d\n", &n); for (int i = 0; compare(i, n) == -1; i++) { /* ここの大小比較も忘れずに */ int a, b; scanf("%d %d\n", &a, &b); if (compare(a, b) == 1) { /* ASCIIコードから変換 */ printf("%c\n", 62); } else if (a == b) { puts("="); } else { printf("%c\n", 60); } } return 0; }