結果

問題 No.167 N^M mod 10
ユーザー orca37
提出日時 2018-02-16 23:28:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 222 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 53,716 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 06:21:01
合計ジャッジ時間 1,983 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int main(){
  int N,M;
  cin >> N >>M;
 if(M==0){cout<<1;return 0;}
  N%=10;
  M=M%4+4;
  int ans=1;
  int i;
  for(i=0;i<M;i++){
    ans=(ans*N)%10;
}
  cout << ans;
 return 0;
}

0