結果
問題 |
No.167 N^M mod 10
|
ユーザー |
![]() |
提出日時 | 2015-03-19 23:50:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 469 bytes |
コンパイル時間 | 431 ms |
コンパイル使用メモリ | 56,548 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 23:26:08 |
合計ジャッジ時間 | 1,373 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 WA * 5 |
ソースコード
// Ω\ζ°)チーン #include <iostream> #include <cstdio> int main(){ std::string S, T; std::cin >> S >> T; while(T.size() < 2){ T = '0' + T; } int n = S[S.size()-1] - '0', m = (T[T.size()-2]-'0') * 10 + (T[T.size()-1]-'0'); if(n == 0){ std::cout << 0 << std::endl; }else{ int res = 1; for(int i=0;i<m;i++){ res = res * n % 10; } std::cout << res << std::endl; } }