当前位置:网站首页>Hdu-1097-a hard puzzle (fast power)
Hdu-1097-a hard puzzle (fast power)
2022-07-28 06:51:00 【__ Simon】
A hard puzzle
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 39822 Accepted Submission(s): 14354
this puzzle describes that: gave a and b,how to know the a^b's the last digit number.But everybody is too lazy to slove this problem,so they remit to you who is wise.
7 66 8 800
9 6
eddy
Fast power template .
#include<iostream>
using namespace std;
typedef long long ll;
void ksm(int a,int b){
int r=1;
int base=a%10;
while(b){
if(b&1){
r=r*base%10;
}
base=base*base%10;
b>>=1;
}
cout<<r%10<<endl;
}
int main(){
int a,b;
while(cin>>a>>b){
ksm(a,b);
}
return 0;
}边栏推荐
猜你喜欢
![[pta---- output full arrangement]](/img/66/d1699cd55fa5ff4a55e3e150d02c1b.png)
[pta---- output full arrangement]

mongo ssl 配置实战

Analysis of the semaphore source code of AQS
![[C language] string library function introduction and simulation](/img/83/b23fdcbbbd792029083b310c89d4bc.png)
[C language] string library function introduction and simulation

KVM hot migration

搭建PHP7私有仓库

Yapi vulnerability hanging horse program chongfu.sh processing

Mongodb quick start

Analysis of reentrantlock source code of AQS

MySQL master-slave
随机推荐
搭建PHP7私有仓库
等保3.0-服务器三权分立配置
[untitled]
MySQL常用命令
[pta---- output full arrangement]
[queue, simple application of stack ---- packaging machine]
Leetcode brush question diary sword finger offer II 055. binary search tree iterator
Question brushing record - linked list
What is the most practical gift for Tanabata? A gift that will never go wrong is worth buying
什么是线性表?
How about air conduction Bluetooth headset? It's the most worthwhile air conduction headset to start with
KVM hot migration
Which brand of air conduction earphones is better? These four should not be missed
---栈&队列---
JS逆向100题——第1题
技术分享 | 实战详解接口测试请求方式Get、post
@Postconstruct annotations and useful examples
Personal understanding of Chinese remainder theorem
技术分享 | 接口测试常用代理工具
JS reverse question 100 - question 1