HDU1097
来源:互联网 发布:中国经济史图书知乎 编辑:程序博客网 时间:2024/05/29 10:22
A hard puzzle
Problem Description
lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than begin.
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.
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.
Input
There are mutiple test cases. Each test cases consists of two numbers a and b(0<a,b<=2^30)
Output
For each test case, you should output the a^b's last digit number.
Sample Input
7 668 800
Sample Output
96//HDU1097 基础题//A hard puzzle http://acm.hdu.edu.cn/showproblem.php?pid=1097//2017.06.23 by wyj#include#include using namespace std;int main(){int a, b, p;while (scanf("%d%d", &a, &b) != EOF){p = 1;a %= 10;b %= 4;if (b == 0)b = 4;while (b--){p *= a;}printf("%d\n", p % 10);}return 0;}
阅读全文
0 0
- hdu1097
- HDU1097
- hdu1097
- hdu1097
- HDU1097
- hdu1097
- HDU1097
- HDU1097
- hdu1097
- HDU1097
- hdu1097
- HDU1097
- HDU1097
- 【HDU1097】John
- hdu1097 A hard puzzle
- A hard puzzle(HDU1097)
- hdu1097 A hard puzzle
- HDU1097 A hard puzzle
- 第六章 继承
- Java工程师面试必看
- 神经网络中优化器的作用
- iOS11 Xcode 9 快速跳转到定义新姿势(Jump to Definition)
- JS 数组模糊搜索
- HDU1097
- BaseActivity中封装权限动态适配
- 《deep learning》学习笔记(4)——数值计算
- 在MAC OSX10.10上安装OpenCV2.4.10全过程(含Homwbrew,cmake安装,在XCode6.1.1上配置OpenCV2.4.10)
- getopt----解析命令选项及参数
- 第四周项目一
- 第七章 接口
- Oracle---number数据类型
- SpringMVC中的参数绑定总结