結果

問題 No.167 N^M mod 10
ユーザー mnr
提出日時 2020-03-02 13:59:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 243 bytes
コンパイル時間 1,335 ms
コンパイル使用メモリ 167,124 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-13 21:01:35
合計ジャッジ時間 2,133 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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