結果

問題 No.3032 Unavailability of Inequality Signs
ユーザー hirakich1000000007hirakich1000000007
提出日時 2018-12-25 23:29:06
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 133 ms
コンパイル使用メモリ 29,696 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-09 02:48:33
合計ジャッジ時間 895 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,948 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,948 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:11:1: warning: return type defaults to 'int' [-Wimplicit-int]
   11 | main(){
      | ^~~~
main.c: In function 'main':
main.c:13:5: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   13 |     scanf("%d", &n);
      |     ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int issmaller (int a, int b) {
main.c:13:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   13 |     scanf("%d", &n);
      |     ^~~~~
main.c:13:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:18:13: warning: implicit declaration of function 'putchar' [-Wimplicit-function-declaration]
   18 |             putchar('=');
      |             ^~~~~~~
main.c:18:13: note: include '<stdio.h>' or provide a declaration of 'putchar'

ソースコード

diff #

int issmaller (int a, int b) {
    int h = 1073741824;
    while (h) {
        if (!(a & h) && (b & h)) return 1;
        if ((a & h) && !(b & h)) return 0;
        h /= 2;
    }
    return 0;
}

main(){
    int n;
    scanf("%d", &n);
    while (n--) {
        int a, b;
        scanf("%d%d", &a, &b);
        if (a == b) {
            putchar('=');
        } else {
            putchar(issmaller(a, b) ? 0x3c : 0x3e);
        }
        putchar('\n');
    }
}
0