HDU1061 Rightmost Digit
来源:互联网 发布:褥子什么材质的好 知乎 编辑:程序博客网 时间:2024/05/17 23:41
题意:
求N^N的最右位数字
快速幂解决
#include<cstdio>#include<algorithm>using namespace std;int main(){int total;scanf("%d",&total);while(total--){int n;scanf("%d",&n);int m=n;//n^mint ans=1;n%=10;while(m){if(m&1)//m为奇数{ans*=n;ans%=10;}m>>=1;n*=n;n%=10;}printf("%d\n",ans%10);}return 0;}
- HDU1061:Rightmost Digit
- HDU1061 Rightmost Digit
- Rightmost Digit(HDU1061)
- hdu1061 Rightmost Digit
- HDU1061 Rightmost Digit
- HDU1061 Rightmost Digit
- hdu1061 Rightmost Digit
- Rightmost Digit(hdu1061)
- hdu1061 rightmost digit
- HDU1061 Rightmost Digit
- HDU1061-Rightmost Digit(快速幂取模)
- HDU1061:Rightmost Digit(快速幂取模)
- HDU1061-Rightmost Digit(快速幂取模)
- hdu1061——Rightmost Digit
- HDU1061 Rightmost Digit(快速幂取模)
- 【快速幂取模】HDU1061 Rightmost Digit
- HDU1061——Rightmost Digit
- Rightmost Digit(hdu1061二分取模)
- 虚拟机上安装RatHat
- VS中CTRL+E,CTRL+D自动缩进功能不能使用的问题
- Intel 80386 微处理器的系统结构
- 使用CompilerResults 方法动态的编译类
- JAX-WS动态调用Web Service
- HDU1061 Rightmost Digit
- 从错误中得知--有关malloc自己容易错的地方。
- 重新想象 Windows 8 Store Apps (16)
- 树状数组
- valgrind
- C#TreeView 实现无线级别分类
- 闲来无事敲代码,各种自挂东南枝(java第五章例题)
- 键盘记录code
- 并查集