結果
| 問題 |
No.167 N^M mod 10
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-24 21:53:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 598 bytes |
| コンパイル時間 | 665 ms |
| コンパイル使用メモリ | 81,912 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 10:49:35 |
| 合計ジャッジ時間 | 1,550 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 WA * 4 |
ソースコード
#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;
if(b=="0"){
{
cout<<1<<endl;
return 0;
}
}
int t=0,n=0;b="0"+b;
n=b[b.size()-1]-'0'+(b[b.size()-2]-'0')*10;
n%=4;
t=a[a.size()-1]-'0';
//if(!n)n=4;
int y=t;
//cout<<n;
for(int i=0;i<n-1;i++)
y*=t;
cout<<y%10<<endl;
return 0;
}