結果
| 問題 |
No.167 N^M mod 10
|
| コンテスト | |
| ユーザー |
SeiyaT
|
| 提出日時 | 2021-09-10 17:58:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 394 bytes |
| コンパイル時間 | 1,446 ms |
| コンパイル使用メモリ | 173,376 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-11 17:00:07 |
| 合計ジャッジ時間 | 2,285 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll mod=1000000007;
ll INF=1LL<<60;
int main() {
string N,M;
cin >> N >> M;
vector<vector<int>> A={{0,0,0,0},{1,1,1,1},{6,2,4,8},{1,3,9,7},{6,4,6,4},{5,5,5,5},{6,6,6,6},{1,7,9,3},{6,8,4,2},{1,9,1,9}};
int B=N.back()-'0',C;
if(M.size()>=2)C=stoi(M.substr(M.size()-2,2))%4;
else C=(M[0]-'0')%4;
cout << A[B][C] << endl;
}
SeiyaT