結果

問題 No.167 N^M mod 10
ユーザー firiexpfiriexp
提出日時 2018-07-26 18:16:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 309 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 64,252 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-13 18:44:16
合計ジャッジ時間 3,716 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 WA -
testcase_07 RE -
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 RE -
testcase_11 AC 1 ms
4,376 KB
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 RE -
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using ll = long long;
using namespace std;

int main() {
    string n, m;
    int a, b, ans = 1;
    cin >> n >> m;
    a = n.back()- '0';
    b = stoi(m.substr(m.size()-2,2)) % 4;
    for (int i = 0; i < b; ++i) {
        ans = (ans * a)%10;
    }
    cout << ans << "\n";
    return 0;
}
0