当前位置:网站首页>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;
}边栏推荐
- Analysis of cyclicbarrier source code of AQS
- [explain in detail how to realize Sanzi chess step by step]
- About the collation of shader keyword
- rancher部署实战
- What is the good brand of air conduction Bluetooth headset and the best brand recommendation of air conduction headset
- HDU-1097-A hard puzzle(快速幂)
- Initializingbean interface and examples
- 软件测试的生命周期(流程)
- Graphic pipeline foundation (I)
- Rain Scene Effect (I)
猜你喜欢

Personal understanding of Chinese remainder theorem

Which is the best and most cost-effective air conduction headset recommended

What kind of air conduction Bluetooth headset with good configuration is recommended

Mysql-8.0.17-winx64 (additional Navicat) manual configuration version installation

Water bottle effect production

技术分享 | 如何模拟真实使用场景?mock 技术来帮你

RayMarching实现体积光渲染

QGraphicsView提升为QChartView

JS逆向100题——第1题

Water drop effect on umbrella
随机推荐
网络——数据链路层
QT使用MSVC编译器输出中文乱码问题
Project compilation nosuch*** error problem
AQS之ReentrantLock源码解析
SSAO by computer shader (I)
技术分享 | 实战详解接口测试请求方式Get、post
Rain Scene Effect (I)
Water bottle effect production
[untitled]
NIO示例
测试面试题集锦(三)| 计算机网络和数据库篇(附答案)
Lancher deployment practice
Skimming records -- sequence traversal of binary tree
SSAO by computer shader (III)
NiO example
[queue, simple application of stack ---- packaging machine]
AQS之countDownLatch源码分析
PKU-2524-Ubiquitous Religions(并查集模板)
Question skimming record - hash table
JS reverse question 100 - question 1