結果
問題 | No.167 N^M mod 10 |
ユーザー | takeya_okino |
提出日時 | 2019-08-22 19:51:19 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 625 bytes |
コンパイル時間 | 2,115 ms |
コンパイル使用メモリ | 76,916 KB |
実行使用メモリ | 56,044 KB |
最終ジャッジ日時 | 2024-04-20 22:04:03 |
合計ジャッジ時間 | 6,486 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 112 ms
40,172 KB |
testcase_01 | WA | - |
testcase_02 | AC | 136 ms
41,416 KB |
testcase_03 | AC | 130 ms
41,416 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 99 ms
41,276 KB |
testcase_07 | AC | 114 ms
41,004 KB |
testcase_08 | AC | 112 ms
41,332 KB |
testcase_09 | AC | 112 ms
41,112 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 100 ms
40,024 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | AC | 116 ms
41,176 KB |
testcase_18 | AC | 115 ms
40,084 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 126 ms
41,316 KB |
testcase_23 | AC | 131 ms
41,344 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 141 ms
41,304 KB |
testcase_27 | WA | - |
testcase_28 | AC | 143 ms
41,316 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String n = sc.next(); String m = sc.next(); int d = Integer.parseInt(String.valueOf(n.charAt(n.length() - 1))); int e = 0; if(m.length() > 1) { e = Integer.parseInt(String.valueOf(m.charAt(m.length() - 2)) + String.valueOf(m.charAt(n.length() - 1))); } else { e = Integer.parseInt(String.valueOf(m.charAt(0))); } e = (e % 4); int ans = 1; for(int i = 0; i < e; i++) { ans *= d; } if(d == 0) ans = 0; System.out.println(ans); } }