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. Linux内存性能指标、CPU性能指标

    内存性能指标 内存基础概念 先执行一下 top 命令,看结果中关于内存的相关部分 # top 其中的 VIRT.RES.SWAP 都是什么呢? 分别是下面的3个概念: 物理内存 Resident - ...

  2. php文件上传进度条例子

    <?php session_start(); ?> <!DOCTYPE html> <html lang="zh-CN"> <head&g ...

  3. php 时间倒计时

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. Tomcat7配置数据源

    http://www.cnblogs.com/ITtangtang/archive/2012/05/21/2511749.html

  5. float 的有效数字为七位是怎么得出来的

    以下内容来自CSDN网友xian_wwq的回答(http://bbs.csdn.net/topics/390874239): float:   1bit(符号位) 8bits(指数位) 23bits( ...

  6. Bat脚本实现MySQL数据库SQL文件备份

    @echo offecho 在线兑奖系统自动备份脚本(请勿关闭) 联系人:  电话::loopset /a "FDate=%date:~,4%%date:~5,2%%date:~8,2%&q ...

  7. HTML5头部标签备忘

    DOCTYPE DOCTYPE(Document Type),该声明位于文档中最前面的位置,处于html 标签之前,此标签告知浏览器文档使用哪种HTML 或者XHTML 规范. 推荐使用HTML5 推 ...

  8. C# 指针操作图像 二值化处理

    /// <summary> /// 二值化图像 /// </summary> /// <param name="bmp"></param& ...

  9. Toast通知

    win10 app 开发中Toast通知的模板只有一种,统一为 ToastGeneric 通用型通知,本文我们来讲讲 Toast 的 XML文档相关知识. 在以前8.1时候的Toast通知方式,到了W ...

  10. Build better apps: Windows 10 by 10 development series

    http://blogs.windows.com/buildingapps/2015/08/05/build-better-apps-windows-10-by-10-development-seri ...