[热身题][hdoj_1061]Rightmost Digit 右值
来源:互联网 发布:centos7端口无法打开 编辑:程序博客网 时间:2024/05/16 14:31
// hdoj_1061 Rightmost Digit 右值// 0MS228K253 BGCC#include <stdio.h>int main(vodi){int i, ncase, m, n, t;scanf("%d", &ncase);while(ncase--){scanf("%ld", &n);t = n % 10;m = 1;for(i = 0; i <= (n-1)%4; i ++) //此处可换为 i < n%4 + 4;可解决n%4 ==0的情况{m *= t;;}printf("%d\n", m%10);}return 0;}
/*末位数 相乘后的末位数1 12 4 8 6 23 9 7 1 34 6 45 56 67 9 3 1 78 4 2 6 89 1 9(由于x9是奇数,所以1不会出现)0 0由上面的分析可见,每个数相乘后最多有四个结果所以对一个数n,只需做其对4取余后余数次相乘即可但是会出现 n%4 == 0 的情况由于x5^x5的末位数是5,x9^x9的末位数是9所以将n%4转换为(n-1)%4*/
- [热身题][hdoj_1061]Rightmost Digit 右值
- [热身题][hdoj_1060]Leftmost Digit
- hdoj1061 Rightmost Digit(简单题)
- Rightmost Digit
- Rightmost Digit
- Rightmost Digit
- Rightmost Digit
- Rightmost digit
- Rightmost Digit
- Rightmost Digit
- Rightmost Digit
- Rightmost Digit
- Rightmost Digit
- Rightmost Digit
- Rightmost Digit
- Rightmost Digit
- Rightmost Digit
- Rightmost Digit
- Model.find_in_batches
- struts2对Action的作用域的管理
- 寻址方式
- 排序算法:希尔、归并、快速、堆排序
- 杭电ACM 2023 求平均成绩
- [热身题][hdoj_1061]Rightmost Digit 右值
- JVM内存管理:深入Java内存区域与OOM
- 设置不使用缓存的过滤器
- Perl 内部结构详解 -- PerlGuts Illustrated (4 HV)
- http://blog.163.com/ecy_fu/blog/static/4445126200921512556887/
- Dividing
- Active Record介绍
- Oracle Date to Unix Timestamp
- How to change Red Hat Linux to boot to command line mode from Gnome