結果

問題 No.167 N^M mod 10
ユーザー mnrmnr
提出日時 2020-03-06 07:44:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 275 bytes
コンパイル時間 1,367 ms
コンパイル使用メモリ 162,048 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 03:44:38
合計ジャッジ時間 2,141 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 15 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int mulm(int a, int b) {
  return ((a % 10) * (b % 10)) % 10;
}

int main() {
  int N; int M;
  cin >> N;
  cin >> M;
  int n = N % 10;
  int k = n;
  for (int i = 0; i < M-1; i++) {
    k = mulm(n,k);
  }
  cout << k << endl;
}
0