摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1061 题目大意:求N^N的个位数 关键思想:对1个N来说,乘方时末尾会循环。对所有N来说,结果以20为周期。 代码如下(第一种方法:循环节): (第二种方法:打表) 阅读全文
posted @ 2017-03-06 22:25 哇咔咔咔 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1060 题目大意:求N^N的最高位数字。 关键思想:换底公式使结果变为10^(N*log10(N)),再除以10^(digits-1)就OK了。 代码如下: 阅读全文
posted @ 2017-03-06 21:36 哇咔咔咔 阅读(125) 评论(0) 推荐(0) 编辑