A hard puzzle

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 23766    Accepted Submission(s): 8390

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.

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 66 8 800

Sample Output

9 6

Author

eddy

Recommend

JGShining

#include<stdio.h>
int pow(int a,int b)
{
if (b==) return ;
if (b==) return a;
int x=pow(a,b/);
if (b%==) return (x*x)%;
else return (x*x*a)%;
}
int main()
{
int a,b;
while (scanf("%d%d",&a,&b)!=EOF)
{
a%=;
printf("%d\n",pow(a,b));
}
return ;
}

A hard puzzle的更多相关文章

  1. Puzzle 面向服务/切面(AOP/IOC)开发框架 For .Net

    Puzzle 面向服务/切面AOP开发框架 For .Net AOP主要实现的目的是针对业务处理过程中的切面进行提取,它所面对的是处理过程中的某个步骤或阶段,以获得逻辑过程中各部分之间低耦合性的隔离效 ...

  2. HDU5456 Matches Puzzle Game(DP)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5456 Description As an exciting puzzle game for ...

  3. one recursive approach for 3, hdu 1016 (with an improved version) , permutations, N-Queens puzzle 分类: hdoj 2015-07-19 16:49 86人阅读 评论(0) 收藏

    one recursive approach to solve hdu 1016, list all permutations, solve N-Queens puzzle. reference: t ...

  4. poj3678 Katu Puzzle 2-SAT

    Katu Puzzle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6714   Accepted: 2472 Descr ...

  5. POJ1651Multiplication Puzzle[区间DP]

    Multiplication Puzzle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8737   Accepted:  ...

  6. codeforce B Island Puzzle

    B. Island Puzzle time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  7. poj 1651 Multiplication Puzzle (区间dp)

    题目链接:http://poj.org/problem?id=1651 Description The multiplication puzzle is played with a row of ca ...

  8. Ignatius's puzzle

    Ignatius's puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  9. hdu 1097 A hard puzzle

    Problem Description lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how ...

随机推荐

  1. velocity思维导图笔记

  2. hdu 2087剪花布条

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2087 思路:正常KMP求解aaaaaa  aa得到的结果是6,这题是3.仅仅改一点代码就行 当匹配完之 ...

  3. 端口扫描之王-----------nmap

    [root@ok data]# nmap -F -sT -v nmap.org Starting Nmap 5.51 ( http://nmap.org ) at 2016-10-23 12:46 C ...

  4. SQL——触发器——插入触发器——边学边项目写的。

    需求: 项目表项目编码触发器编写 为项目表DwProject编写触发器,目的为当创建新项目时,且ProjectNo 为Null或空字符串时,自动创建项目编号,编号格式为4位年号,2位月份,2位顺序号, ...

  5. pyinstaller打包pyqt文件

    打包pyqt文件 如何将pyqt生成exe的二进制文件呢,pyinstaller就是这样的工具 可以将脚本文件.py 文件转换为编辑后的二进制文件,在进行发布 下面说下,如果打包 一. 安装: 下载地 ...

  6. 【翻译十四】java-并发之保护块儿

    Guarded Blocks Threads often have to coordinate their actions. The most common coordination idiom is ...

  7. 【JAVA正则表达式】

    一.String类. java.lang.Object |--java.lang.String 常用方法:  String replaceAll(String regex, String replac ...

  8. Ubuntu / Win7 安装db2 v10.5

    抓紧下载v10.5fp1_linuxx64_expc.tar.gz到~/Downloads/java_softcd java_softtar xf v10.5fp1_linuxx64_expc.tar ...

  9. .NET Nancy 详解(二) 简易路由实现

    继续上面的简易版本,有意思的点剩下便是路由实现了. 路由注册 首先,来看一下基本的路由注册过程. public FakeNancyModuleWithoutBasePath() { Delete[&q ...

  10. HR外包系统 - 客户员工 发薪需求/个税需求 设置

    最好,客户公司层面进行设置,如果单一情况,只需要设置公司,如果不是单一情况,设置员工, 另外员工只能从公司设置好的地方选择过来. 增强系统简便设置和设置的灵活性.