当前位置:网站首页>HDU-1097-A hard puzzle(快速幂)
HDU-1097-A hard puzzle(快速幂)
2022-07-28 05:28: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
快速幂模板。
#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;
}边栏推荐
- Battle plague Cup -- my account book
- Analysis of cyclicbarrier source code of AQS
- 网络——传输层(详细版)
- OJ 1242 大一上之初出茅庐
- 水瓶效果制作
- 雨伞上的水滴效果
- Optimization ideas from ordinary query commodities to highly concurrent query commodities
- 软件测试的生命周期(流程)
- Mysql-8.0.17-winx64 (additional Navicat) manual configuration version installation
- ISO 3.0-server three power separation configuration
猜你喜欢

Water drop effect on umbrella
![[basic knowledge of binary tree]](/img/4f/9fc27a30b958af26537c299e150ee9.png)
[basic knowledge of binary tree]

explain详解

mysql-8.0.17-winx64(附加navicat)手动配置版安装

Leetcode brush question diary sword finger offer II 048. serialization and deserialization binary tree

mongoDB复制集及分片集群

rancher部署实战

SSAO by computer shader (III)

Analysis of the semaphore source code of AQS
![[queue, simple application of stack ---- packaging machine]](/img/bc/617b1eb35558c4f948018f593a1de5.jpg)
[queue, simple application of stack ---- packaging machine]
随机推荐
Analysis of cyclicbarrier source code of AQS
链表中结点的插入和删除
NFT data storage blind box + mode system development
---栈&队列---
OJ 1451 digital games
Question brushing record -- binary tree
mongoDB快速入门
prometheus监控nacos
Yapi vulnerability hanging horse program chongfu.sh processing
Source code analysis of countdownlatch of AQS
Question brushing record - linked list
浅谈Cookie和Session
SSAO by computer shader (III)
Fermat's theorem
网络通信及TCP/IP协议
Redis implementation of distributed lock and analysis of the main process of redismission distributed lock
Lancher deployment practice
Code neatness (2)
网络——传输层(详细版)
Mongodb quick start