結果

問題 No.167 N^M mod 10
ユーザー naimonon77
提出日時 2015-12-03 16:24:13
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 687 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 57,576 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-14 08:27:39
合計ジャッジ時間 1,641 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#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) << endl;

  return 0;
}
0