結果

問題 No.167 N^M mod 10
ユーザー uenoku
提出日時 2017-01-25 02:41:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 77,256 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-23 08:08:14
合計ジャッジ時間 1,549 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define mp make_pair
using namespace std;
typedef long long int lli;
lli MOD = 1000000007;
int main()
{
    string n, m;
    cin >> n >> m;
    int a = n[n.size() - 1] - '0';
    int b = m[m.size() - 1] - '0';
    int ans = 1;
    rep(i, b)
    {
        ans *= a;
    }
    if (a == 0 && b == 0)
        ans = 0;
    cout << ans % 10 << endl;
}
0