当前位置:网站首页>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;
}边栏推荐
- 软件测试(概念篇)
- SSAO by computer shader (II)
- HDU-5806-NanoApeLovesSequenceⅡ(尺取法)
- Water rendering example
- explain详解
- Lancher deployment practice
- redis缓存设计与性能优化
- Analysis of cyclicbarrier source code of AQS
- Graphic pipeline foundation (part outside)
- Ten thousand words summarize and realize the commonly used sorting and performance comparison
猜你喜欢

技术分享 | 服务端接口自动化测试, Requests 库的这些功能你了解吗?

【无标题】

What is the good brand of air conduction Bluetooth headset and the best brand recommendation of air conduction headset

Prometheus monitoring Nacos

Graphic pipeline foundation (part outside)

Source code analysis of countdownlatch of AQS

Project compilation nosuch*** error problem

NIO示例

mongoDB复制集及分片集群

Mongodb replica set and partitioned cluster
随机推荐
Redis implementation of distributed lock and analysis of the main process of redismission distributed lock
Ubuntu18.04搭建redis集群【学习笔记】
RayMarching实现体积光渲染
C language memcpy library functions and the role of memmove
Initializingbean interface and examples
@Postconstruct annotations and useful examples
Centos7 deploy MySQL database server
QT使用MSVC编译器输出中文乱码问题
NiO example
SSAO by computer shader (III)
How to store floating point data in memory
[untitled]
mysql-8.0.17-winx64(附加navicat)手动配置版安装
How to simulate the implementation of strcpy library functions
Dynamic planning -- multi-step stair climbing (advanced version of stair climbing)
遍历 二叉树
JS reverse question 100 - question 1
HDU-5783 Divide the Sequence(贪心水题)
Graphic pipeline foundation (II)
VMware Workstation 配置net模式