結果

問題 No.167 N^M mod 10
ユーザー eve__fuyuki
提出日時 2018-03-14 08:51:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 271 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 55,152 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-25 22:34:18
合計ジャッジ時間 1,237 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
using namespace std;
int main(){
    string N,M;
    int n,m,ans=1;
    cin >> N >> M;
    n = (int)N[N.length()-1]-48;
    m = (int)M[M.length()-1]-48;
    for(int i=0;i<m;i++) ans = ans*n%10;
    cout << ans << endl;
    return 0;
}
0