hdu1097 A hard puzzle
来源:互联网 发布:天国王朝知乎 编辑:程序博客网 时间:2024/06/14 10:09
A hard puzzle
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 43138 Accepted Submission(s): 15623
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
//// Created by Admin on 2017/4/7.//#include<cstdio>int main(){ int a,b; while (~scanf("%d%d",&a,&b)){ a%=10; if(a==0||a==1||a==5||a==6)printf("%d\n",a); if(a==2){ if(b%4==1)printf("2\n"); if(b%4==2)printf("4\n"); if(b%4==3)printf("8\n"); if(b%4==0)printf("6\n"); } if(a==3){ if(b%4==1)printf("3\n"); if(b%4==2)printf("9\n"); if(b%4==3)printf("7\n"); if(b%4==0)printf("1\n"); } if(a==4){ if(b%2==1)printf("4\n"); if(b%2==0)printf("6\n"); } if(a==7){ if(b%4==1)printf("7\n"); if(b%4==2)printf("9\n"); if(b%4==3)printf("3\n"); if(b%4==0)printf("1\n"); } if(a==8){ if(b%4==1)printf("8\n"); if(b%4==2)printf("4\n"); if(b%4==3)printf("2\n"); if(b%4==0)printf("6\n"); } if(a==9){ if(b%2==1)printf("9\n"); if(b%2==0)printf("1\n"); } } return 0;}
0 0
- hdu1097 A hard puzzle
- A hard puzzle(HDU1097)
- hdu1097 A hard puzzle
- HDU1097 A hard puzzle
- HDU1097 A hard puzzle
- HDU1097 A hard puzzle
- hdu1097 A hard puzzle
- hdu1097 A hard puzzle
- hdu1097 A hard puzzle
- hdu1097 A hard puzzle
- hdu1097 - A hard puzzle
- hdu1097 A hard puzzle
- HDU1097:A hard puzzle(快速幂求模)
- hdu1097 A hard puzzle(快速幂)
- ACM-数论之A hard puzzle——hdu1097
- HDU1097 A hard puzzle O(1)算法实现
- hdu1097 A hard puzzle hdu5500 Reorder the Books
- A hard puzzle
- JZOJ1268.【USACO题库】2.3.3 Zero Sum和为零
- Vicarious说,现在的深度学习都是渣渣--转自微信
- Android Studio 技巧之【Join Lines and Literals】
- vim 快捷键
- poj1631 Bridging signals
- hdu1097 A hard puzzle
- hdu 1166 敌兵布阵
- Ubuntu下载android源码
- HDU4716-A Computer Graphics Problem
- 有序数组查找第一个比k大的数
- iOS程序员的持续学习
- 用户登录只有第一条数据成功,只能查询到第一条数据
- B1049.数列的片段和
- Java8---接口