当前位置:网站首页>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;
}边栏推荐
- elastic常用高频命令
- [C language] string library function introduction and simulation
- 链表中结点的插入和删除
- TCP/IP五层模型
- feignclient @RequestMapping参数设置及请求头简易方式设置
- Battle plague Cup -- my account book
- JS逆向100题——第1题
- [explain in detail how to realize Sanzi chess step by step]
- About the collation of shader keyword
- JS四则运算重新封装,解决精度丢失问题
猜你喜欢

yapi漏洞挂马程序chongfu.sh处理

Project compilation nosuch*** error problem

SSAO By Computer Shader(一)

Skimming records -- sequence traversal of binary tree

Redis cache design and performance optimization

mysql索引优化

RayMarching实现体积光渲染

SSAO By Computer Shader(二)

Development of clip arbitrage / brick carrying arbitrage system

Mongodb quick start
随机推荐
技术分享 | 如何模拟真实使用场景?mock 技术来帮你
Graphic pipeline foundation (II)
测试面试题集锦(三)| 计算机网络和数据库篇(附答案)
Code neatness (2)
[C note] data type and storage
[dynamic planning -- the best period for buying and selling stocks Series 2]
OJ 1242 大一上之初出茅庐
Array solution script
技术分享 | 使用 cURL 发送请求
SSAO by computer shader (I)
Personal understanding of Chinese remainder theorem
Mongodb quick start
Leetcode brush questions diary sword finger offer II 047. Binary tree pruning
网络通信及TCP/IP协议
Development of Quantitative Trading Robot System
mysql-8.0.17-winx64(附加navicat)手动配置版安装
OJ 1242 freshman's debut
水渲染示例
Implementation of simple address book in [c language]
[untitled]