結果

問題 No.185 和風
コンテスト
ユーザー 大谷祐翔
提出日時 2025-11-10 09:40:47
言語 C#
(.NET 10.0.201)
コンパイル:
dotnet_c
実行:
/usr/bin/dotnet_wrap
結果
WA  
実行時間 -
コード長 798 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,830 ms
コンパイル使用メモリ 170,480 KB
実行使用メモリ 193,132 KB
最終ジャッジ日時 2026-07-16 10:47:04
合計ジャッジ時間 6,306 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 1 MLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (88 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

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

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

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