結果

問題 No.185 和風
コンテスト
ユーザー 大谷祐翔
提出日時 2025-11-07 17:25:13
言語 C#
(.NET 8.0.404)
結果
WA  
実行時間 -
コード長 973 bytes
コンパイル時間 16,717 ms
コンパイル使用メモリ 169,872 KB
実行使用メモリ 187,116 KB
最終ジャッジ日時 2025-11-07 17:25:31
合計ジャッジ時間 9,164 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 1 MLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (93 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

class Program
{
    static void Main(string[] args)
    {
        string inputCount = Console.ReadLine()!;
        int count = int.Parse(inputCount);
        decimal ansCopy = 0;
        
        for (int i = 0; i < count; i++)
        {
            string[] inputNum = Console.ReadLine()!.Split(' ');
            decimal leftNum = decimal.Parse(inputNum[0]);
            decimal rightNum = decimal.Parse(inputNum[1]);

            if (rightNum < leftNum)
            {
                Console.WriteLine(-1);
                break;
            }
            else if (i == 0)
            {
                ansCopy = rightNum - leftNum;
            }
            else
            {
                if (ansCopy != rightNum - leftNum)
                {
                    Console.WriteLine(-1);
                    break;
                }
            }

            if (i == count - 1)
            {
                Console.WriteLine(ansCopy);
            }
        }
    }
}
0