結果
問題 |
No.167 N^M mod 10
|
ユーザー |
|
提出日時 | 2019-08-08 01:04:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 449 bytes |
コンパイル時間 | 2,172 ms |
コンパイル使用メモリ | 194,756 KB |
最終ジャッジ日時 | 2025-01-07 10:59:30 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 2 |
other | AC * 5 RE * 22 |
ソースコード
#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; }