結果
問題 |
No.167 N^M mod 10
|
ユーザー |
|
提出日時 | 2018-07-26 18:16:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 309 bytes |
コンパイル時間 | 635 ms |
コンパイル使用メモリ | 65,084 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-01 03:22:23 |
合計ジャッジ時間 | 2,240 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 WA * 7 RE * 5 |
ソースコード
#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; }