結果

問題 No.3032 Unavailability of Inequality Signs
ユーザー はむ吉🐹はむ吉🐹
提出日時 2018-02-04 22:10:48
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 1,152 bytes
コンパイル時間 3,754 ms
コンパイル使用メモリ 107,740 KB
実行使用メモリ 22,856 KB
最終ジャッジ日時 2023-09-12 16:09:03
合計ジャッジ時間 5,157 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
22,796 KB
testcase_01 AC 55 ms
20,856 KB
testcase_02 AC 56 ms
22,848 KB
testcase_03 AC 54 ms
20,684 KB
testcase_04 AC 56 ms
22,856 KB
testcase_05 AC 56 ms
20,656 KB
testcase_06 AC 56 ms
22,764 KB
testcase_07 AC 55 ms
20,740 KB
testcase_08 AC 55 ms
22,852 KB
testcase_09 AC 57 ms
22,856 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace AvoidIneqCS
{
    class Program
    {
        // 絶対値を用いて大小比較を行う
        static int MyCompare(int a, int b) {
            if (a == b)
            {
                return 0;
            }
            else
            {
                return (a - b) / Math.Abs(a - b);
            }
        }

        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            for (int i = 0; i != n; i++)  // ここにも注意
            {
                string[] ab = Console.ReadLine().Split(' ');
                int a = int.Parse(ab[0]);
                int b = int.Parse(ab[1]);
                var c = MyCompare(a, b);
                if (c == 1)
                {
                    // ASCIIコードから変換
                    Console.WriteLine(((char)62).ToString());
                }
                else if (c == 0)
                {
                    Console.WriteLine("=");
                }
                else
                {
                    Console.WriteLine(((char) 60).ToString());
                }
            }
        }
    }
}
0