hdu 1061 Rightmost Digit
2015-08-07 22:16
411 查看
题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=1061
解题思路:
快速幂。。。
AC代码:
http://acm.hdu.edu.cn/showproblem.php?pid=1061
解题思路:
快速幂。。。
AC代码:
#include <iostream> #include <cstdio> using namespace std; int main(){ int T; scanf("%d",&T); while(T--){ int n; scanf("%d",&n); int tmp = n % 10; int sum = 1; while(n){ if(n&1) sum = (sum*tmp) % 10; tmp = (tmp*tmp)%10; n >>= 1; } printf("%d\n",sum); } return 0; }
相关文章推荐
- WPF 自定义Metro Style窗体
- JavaScript知识点总结-1
- "Accordian" Patience
- C语言字符串,字符转数字,数字转字符(转)
- 黑客步骤
- 在醒着的时间里,追求你认为最有意义的
- Centos 6.5 yum 安装Apache软件
- (C++)虚函数表解析(转)
- 17、C语言和设计模式(中介者模式)
- My split function in Java
- Kotlin教程学习-伴生对象,getter,setter,内部,局部,匿名类,可变参数
- hdoj 2717 Catch That Cow(一维坐标广搜)
- SqlMap参数中文解释
- linux下如何修改iptables开启80端口
- UVALive - 3523 Knights of the Round Table(无向图的双连通分量)
- Python字符串操作之扫描、翻转、截取、输出对齐
- 深入理解javascript之高级定时器
- (15.1.11.1)听力之长对话
- 浅谈Android Fragment嵌套使用存在的一些BUG以及解决方法
- GridView多选错误范例解析