結果

問題 No.167 N^M mod 10
ユーザー aaaaaaiuaaaaaaiu
提出日時 2019-08-08 01:04:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 449 bytes
コンパイル時間 1,935 ms
コンパイル使用メモリ 198,176 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-25 23:20:52
合計ジャッジ時間 6,078 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int f(char c) {
    if ('0' <= c && c <= '9') return c-'0';
    return c-'A'+10;
}

int main() {
    string n,m;
    cin>>n>>m;
    int a=n[n.size()-1]-'0';
    int b;
    if (m.size()>=2) b=stoi(""+m[m.size()-2]+m[m.size()-1]);
    else b=m[m.size()-1]-'0';
    if (b==0) {
        puts("1");
        return 0;
    }
    b=b%4+4;
    cout<<(int)pow(a,b)%10<<endl;
    return 0;
}
0