結果

問題 No.26 シャッフルゲーム
ユーザー hum_ophum_op
提出日時 2016-04-16 14:54:15
言語 F#
(.NET 7)
結果
AC  
実行時間 87 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 3,539 ms
コンパイル使用メモリ 162,576 KB
実行使用メモリ 25,008 KB
最終ジャッジ日時 2023-07-27 14:28:01
合計ジャッジ時間 5,231 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
22,860 KB
testcase_01 AC 86 ms
22,972 KB
testcase_02 AC 86 ms
22,772 KB
testcase_03 AC 87 ms
24,940 KB
testcase_04 AC 87 ms
22,760 KB
testcase_05 AC 86 ms
25,008 KB
testcase_06 AC 86 ms
22,912 KB
testcase_07 AC 86 ms
22,868 KB
testcase_08 AC 85 ms
23,008 KB
testcase_09 AC 86 ms
24,816 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System

let No26 () =
    let N = int <| Console.ReadLine()
    let M = int <| Console.ReadLine()
    let rec res i n =
        if i < M then
            let IN = Console.ReadLine().Split(' ')
            let P, Q = Int32.Parse IN.[0], Int32.Parse IN.[1]
            if n = P then
                res (i + 1) Q
            elif n = Q then
                res (i + 1) P
            else 
                res (i + 1) n
        else
            n
    printfn "%d" <| res 0 N
    ()

No26 ()
0