結果

問題 No.26 シャッフルゲーム
ユーザー swdamdrswdamdr
提出日時 2017-01-25 13:18:28
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 683 bytes
コンパイル時間 2,310 ms
コンパイル使用メモリ 106,544 KB
実行使用メモリ 23,716 KB
最終ジャッジ日時 2023-08-24 22:08:39
合計ジャッジ時間 3,488 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,608 KB
testcase_01 AC 61 ms
21,632 KB
testcase_02 AC 62 ms
23,680 KB
testcase_03 AC 62 ms
23,600 KB
testcase_04 AC 63 ms
21,780 KB
testcase_05 AC 63 ms
21,636 KB
testcase_06 AC 61 ms
21,628 KB
testcase_07 AC 62 ms
21,572 KB
testcase_08 AC 62 ms
23,716 KB
testcase_09 AC 61 ms
21,612 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        int ans = int.Parse(Console.ReadLine());
        long n = long.Parse(Console.ReadLine());

        for (long i = 0; i < n; i++)
        {
            int[] change = Console.ReadLine().Split().Select(a => int.Parse(a)).ToArray();

            if (ans == change[0])
            {
                ans = change[1];
                continue;
            }

            if (ans == change[1])
            {
                ans = change[0];
                continue;
            }
        }

        Console.WriteLine(ans);
        Console.Read();
    }
}

0