結果

問題 No.8032 Unavailability of Inequality Signs
ユーザー southball02
提出日時 2020-08-09 01:19:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 2,144 ms
コンパイル使用メモリ 190,636 KB
最終ジャッジ日時 2025-01-12 19:13:58
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |   int n; scanf("%d", &n);
      |          ~~~~~^~~~~~~~~~
main.cpp:9:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |     int a, b; scanf("%d %d", &a, &b);
      |               ~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

int sgn(int x) { if (x == 0) return 0; return x / abs(x); }

int main() {
  int n; scanf("%d", &n);
  while (n--) {
    int a, b; scanf("%d %d", &a, &b);
    if (sgn(a - b) == 0)
      printf("%c\n", '=');
    else if (sgn(a - b) == -1)
      printf("%c\n", (char)60);
    else
      printf("%c\n", (char)62);
  }
}

0