結果
問題 |
No.167 N^M mod 10
|
ユーザー |
|
提出日時 | 2017-02-06 17:23:58 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 1,615 ms |
コンパイル使用メモリ | 137,216 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 06:55:31 |
合計ジャッジ時間 | 2,196 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string; const tbl = [[0,0,0,0], [1,1,1,1], [6,2,4,8], [1,3,9,7], [6,4,6,4], [5,5,5,5], [6,6,6,6], [1,7,9,3], [6,8,4,2], [1,9,1,9]]; void main() { auto n = readln.chomp; auto m = readln.chomp; if (m == "0") { writeln(1); } else { auto n2 = n.tail(1).to!string.to!int; auto m2 = m.tail(2).to!string.to!int % 4; writeln(tbl[n2][m2]); } }