結果

問題 No.167 N^M mod 10
ユーザー guriceringuricerin
提出日時 2020-01-30 15:49:41
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 937 bytes
コンパイル時間 3,411 ms
コンパイル使用メモリ 164,000 KB
実行使用メモリ 26,180 KB
最終ジャッジ日時 2023-10-14 08:28:55
合計ジャッジ時間 7,074 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 62 ms
22,156 KB
testcase_04 WA -
testcase_05 AC 61 ms
24,332 KB
testcase_06 WA -
testcase_07 AC 61 ms
20,112 KB
testcase_08 AC 60 ms
20,124 KB
testcase_09 AC 61 ms
22,048 KB
testcase_10 AC 62 ms
24,096 KB
testcase_11 WA -
testcase_12 AC 62 ms
22,380 KB
testcase_13 WA -
testcase_14 AC 62 ms
22,200 KB
testcase_15 AC 61 ms
22,140 KB
testcase_16 AC 61 ms
22,052 KB
testcase_17 AC 61 ms
20,116 KB
testcase_18 WA -
testcase_19 AC 61 ms
22,244 KB
testcase_20 WA -
testcase_21 AC 61 ms
24,116 KB
testcase_22 WA -
testcase_23 AC 63 ms
22,204 KB
testcase_24 AC 62 ms
22,240 KB
testcase_25 WA -
testcase_26 AC 62 ms
24,148 KB
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

let main() =
    let n =
        read string
        |> Seq.last
        |> fun x -> Convert.ToInt32(x.ToString())

    let m =
        read string
        |> Seq.last
        |> fun x -> Convert.ToInt32(x.ToString())

    if m = 0 then
        puts 1
    else
        let m = (m - 1) % 4 + 1
        let n = pown n m
        n % 10 |> puts

    ()

main()
writer.Close()
0