HDU1097
来源:互联网 发布:西岐网络 编辑:程序博客网 时间:2024/05/29 10:49
A hard puzzle
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 29887 Accepted Submission(s): 10756
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
Author
eddy
#include<stdio.h>
main()
{
int a,b,c;
while(~scanf("%d%d",&a,&b))
{
b%=4;a%=10;c=a;
if(b==0)
{
b=4;
}
while(--b)
c=c*a%10;
printf("%d\n",c);
}
}
main()
{
int a,b,c;
while(~scanf("%d%d",&a,&b))
{
b%=4;a%=10;c=a;
if(b==0)
{
b=4;
}
while(--b)
c=c*a%10;
printf("%d\n",c);
}
}
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
- ZOJ 1453 Surround the Trees(凸包入门:求凸包周长)
- 八大排序算法
- Cocos2d-x V3.0 Sprite 和 SpriteBatchNode
- 推荐:《嵌入式系统开发之道:菜鸟成长日志与项目经理的私房菜》
- 设计简单的计算器-浙大2006年机试,参考王道机试指南
- HDU1097
- Codeforces Round #272 (Div. 2)AK报告
- java之变量以及对象的存储位置区别
- leetcode Binary Tree Maximum Path Sum 迭代算法
- Mac/Linux/Windows通过命令调用浏览器打开某网页
- 1410121949-hd-1sting
- 第7周项目--求两数的差值
- Max Points on a line ,在二维平面寻找共线的最多点
- 2035 人见人爱A^B