
快速幂
聪明绝顶的你与即将秃头的我
这个作者很懒,什么都没留下…
展开
-
Pseudoprime numbers
Fermat's theorem states that for any prime number p and for any integer a > 1, ap =a (mod p). That is, if we raise a to the pth power and divide by p, the remainder isa. Some (but not very many) no...原创 2018-04-14 09:19:46 · 332 阅读 · 0 评论 -
Rightmost Digit
Given a positive integer N, you should output the most right digit of N^N. InputThe input contains several test cases. The first line of the input is a single integer T which is the number of test cas...原创 2018-04-09 19:36:11 · 718 阅读 · 0 评论 -
人见人爱A^B
Problem Description求A^B的最后三位数表示的整数。说明:A^B的含义是“A的B次方” Input输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=0, B=0,则表示输入数据的结束,不做处理。 Output对于每个测试实例,请输出A^B的最后三位表示的整数,每个输出占一行。 Sample Input2 3 12 ...原创 2018-05-29 19:35:04 · 177 阅读 · 0 评论