結果
問題 |
No.167 N^M mod 10
|
ユーザー |
|
提出日時 | 2016-08-31 02:48:41 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 693 bytes |
コンパイル時間 | 724 ms |
コンパイル使用メモリ | 114,520 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 03:58:23 |
合計ジャッジ時間 | 1,725 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
import std.algorithm, std.array, std.container, std.range; import std.numeric, std.math, std.bigint, std.bitmanip, std.random; import std.string, std.conv, std.stdio, std.typecons; const auto a = [[0, 0, 0, 0], [1, 1, 1, 1], [2, 4, 8, 6], [3, 9, 7, 1], [4, 6, 4, 6], [5, 5, 5, 5], [6, 6, 6, 6], [7, 9, 3, 1], [8, 4, 2, 6], [9, 1, 9, 1]]; void main() { auto n = readln.chomp; auto m = readln.chomp; auto n2 = n[$-1..$].to!int; auto m2 = ("0" ~ m)[$-2..$].to!int; if (m == "0") writeln(1); else writeln(a[n2][(m2 + 3) % 4]); }