結果
問題 |
No.167 N^M mod 10
|
ユーザー |
|
提出日時 | 2016-11-24 21:39:59 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 496 bytes |
コンパイル時間 | 615 ms |
コンパイル使用メモリ | 83,040 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-27 10:49:24 |
合計ジャッジ時間 | 1,595 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 WA * 9 |
ソースコード
#define _USE_MATH_DEFINES #include<stdio.h> #include<string> #include<iostream> #include<cctype> #include<cstdio> #include<vector> #include<stack> #include<queue> #include <algorithm> #include<math.h> #include<set> #include<map> #include<iomanip> //#include<bits/stdc++.h> using namespace std; int main() { string a,b; cin>>a>>b; int t=0,n=0; n=b[b.size()-1]-'0'; n%=4; t=a[a.size()-1]-'0'; if(!n)n=4; int y=t; for(int i=0;i<n-1;i++) y*=t; cout<<y%10<<endl; return 0; }