結果

問題 No.167 N^M mod 10
ユーザー takeya_okinotakeya_okino
提出日時 2019-08-22 19:36:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 586 bytes
コンパイル時間 2,024 ms
コンパイル使用メモリ 85,992 KB
実行使用メモリ 41,584 KB
最終ジャッジ日時 2024-04-20 21:41:51
合計ジャッジ時間 6,424 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 105 ms
40,868 KB
testcase_07 AC 109 ms
40,872 KB
testcase_08 AC 111 ms
41,348 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 116 ms
41,068 KB
testcase_13 WA -
testcase_14 AC 98 ms
40,144 KB
testcase_15 WA -
testcase_16 AC 112 ms
41,128 KB
testcase_17 AC 100 ms
40,096 KB
testcase_18 AC 116 ms
41,408 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 134 ms
41,188 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;
    }
    if(d == 0) ans = 0;
    System.out.println(ans);
  }
}
0