結果
| 問題 |
No.167 N^M mod 10
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-03 16:29:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 689 bytes |
| コンパイル時間 | 437 ms |
| コンパイル使用メモリ | 57,396 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-14 08:27:40 |
| 合計ジャッジ時間 | 1,312 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 WA * 16 |
ソースコード
#include <iostream>
#include <cstring>
#include <algorithm>
#include <limits.h>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/* */
/* ll_pow(x,n)はx^nを返すよ! */
ll ll_pow(ll x,ll n) {
ll res = 1;
while(n > 0) {
if(n&1) res = res * x;
x = x * x;
n >>= 1;
}
return res;
}
int n;
void suuzi(char s[],int i,int& j)
{
for(; j < n/2; j++) {
if(s[i+j] < '0' || '9' < s[i+j]) break;
}
}
int main(void)
{
int i,j,k,l;
int n,m;
cin >> n >> m;
cout << ll_pow(n%10,m%4)%10 << endl;
return 0;
}