結果
問題 | No.167 N^M mod 10 |
ユーザー |
![]() |
提出日時 | 2020-03-24 10:18:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 1,000 ms |
コード長 | 606 bytes |
コンパイル時間 | 2,733 ms |
コンパイル使用メモリ | 197,892 KB |
最終ジャッジ日時 | 2025-01-09 10:00:35 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
#include<bits/stdc++.h>using lint=long long;int main(){std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);std::cout.setf(std::ios_base::fixed);std::cout.precision(15);std::vector<std::vector<lint>>pow(10,std::vector<lint>(11));for(lint i=0;i<10;i++){for(lint j=0,k=1;j<=10;j++,k*=i,k%=10){pow.at(i).at(j)=k;}}std::string s,t;std::cin>>s>>t;lint a=s.back()-'0';lint ans=1;for(char c:std::string(t.rbegin(),t.rend())){ans=ans*pow.at(a).at(c-'0')%10;a=pow.at(a).at(10);}std::cout<<ans<<'\n';}