結果

問題 No.167 N^M mod 10
ユーザー takeya_okinotakeya_okino
提出日時 2019-08-22 19:34:50
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 2,197 ms
コンパイル使用メモリ 77,948 KB
実行使用メモリ 41,836 KB
最終ジャッジ日時 2024-04-20 21:38:20
合計ジャッジ時間 7,156 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 113 ms
40,188 KB
testcase_07 AC 112 ms
40,020 KB
testcase_08 AC 126 ms
40,992 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 125 ms
41,104 KB
testcase_13 WA -
testcase_14 AC 126 ms
41,012 KB
testcase_15 WA -
testcase_16 AC 129 ms
41,044 KB
testcase_17 AC 128 ms
41,836 KB
testcase_18 AC 130 ms
41,056 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 137 ms
41,400 KB
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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(0)));
    int e = 0;
    if(m.length() > 1) {
      e = Integer.parseInt(String.valueOf(m.charAt(1)) + String.valueOf(m.charAt(0)));
    } else {
      e = Integer.parseInt(String.valueOf(m.charAt(0)));
    }
    e = (e % 4);
    int ans = 1;
    for(int i = 0; i < e; i++) {
      ans *= d;
    }
    System.out.println(ans);
  }
}
0