結果
問題 |
No.167 N^M mod 10
|
ユーザー |
![]() |
提出日時 | 2020-09-10 10:54:04 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 843 bytes |
コンパイル時間 | 1,050 ms |
コンパイル使用メモリ | 104,576 KB |
実行使用メモリ | 17,792 KB |
最終ジャッジ日時 | 2024-12-22 21:00:08 |
合計ジャッジ時間 | 3,109 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 2 |
other | RE * 27 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Numerics; using System; public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var L = line[0].Length; var n = line[0][L - 1] - '0'; if (L == 0) { Console.WriteLine(0); goto exit; } BigInteger m2 = BigInteger.Parse(line[1]); if (m2 == 0) { Console.WriteLine(1); goto exit; } var m3 = m2 % 4; var m = (int)m2; if (m == 0) m = 3; else m--; var map = makeMap(); Console.WriteLine(map[n,m]); exit:; } static int[,] makeMap() { var map = new int[10, 4]; for (int i = 0; i < 10; i++) map[i, 0] = i; for (int i = 0; i < 10; i++) for (int j = 1; j < 4; j++) map[i, j] = (map[i, j - 1] * i) % 10; return map; } }