結果
| 問題 | No.167 N^M mod 10 |
| コンテスト | |
| ユーザー |
saytakaPC
|
| 提出日時 | 2015-03-20 00:03:47 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 272 bytes |
| 記録 | |
| コンパイル時間 | 1,179 ms |
| コンパイル使用メモリ | 176,412 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2026-03-18 06:32:34 |
| 合計ジャッジ時間 | 3,843 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 WA * 15 TLE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m,data=1;
scanf("%d%d",&n,&m);
n=n*n%10;
if(m%2==0){
for(int i=0;i<m/2;i++){
data*=n;data%=10;
}
}else{
for(int i=0;i<m/2;i++){
data*=n;data%=10;
}
data*=n;
}
printf("%d\n",data%10);
}
saytakaPC