結果

問題 No.167 N^M mod 10
ユーザー troro_kelp
提出日時 2018-12-21 21:49:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 510 bytes
コンパイル時間 823 ms
コンパイル使用メモリ 89,624 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-25 09:36:20
合計ジャッジ時間 1,717 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
using ll = long long;
using namespace std;
int main(void)
{
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    int tmp = s[n - 1] - '0';
    int num = (t[m - 2] - '0') * 10 + (t[m - 1] - '0');
    num %= 4;

    //cout << tmp << " " << num << endl;
    int ababa = (int)pow(tmp, num) % 10;
    cout << ababa << endl;
    return 0;
}
0