随笔分类 -  数学-数论-快速幂

摘要:题目连接http://acm.hdu.edu.cn/showproblem.php?pid=2035人见人爱A^BDescription求A^B的最后三位数表示的整数。说明:A^B的含义是“A的B次方”Input输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1#include#i... 阅读全文
posted @ 2015-09-08 19:52 GadyPu 阅读(209) 评论(0) 推荐(0)
摘要:题目连接http://acm.hdu.edu.cn/showproblem.php?pid=1575Tr ADescriptionA为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973。Input数据的第一行是一个T,表示有T组数据。每组数据的第一行有n(2 #... 阅读全文
posted @ 2015-09-08 19:41 GadyPu 阅读(153) 评论(0) 推荐(0)
摘要:题目连接http://acm.hdu.edu.cn/showproblem.php?pid=1061Rightmost DigitDescriptionGiven a positive integer N, you should output the most right digit of N^N.... 阅读全文
posted @ 2015-09-08 19:15 GadyPu 阅读(169) 评论(0) 推荐(0)
摘要:题目连接http://acm.hdu.edu.cn/showproblem.php?pid=1005Number SequenceDescriptionA number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(... 阅读全文
posted @ 2015-09-08 18:32 GadyPu 阅读(183) 评论(0) 推荐(0)
摘要:题目连接http://poj.org/problem?id=3641Pseudoprime numbersDescriptionFermat's theorem states that for any prime numberpand for any integera> 1,ap=a(modp). ... 阅读全文
posted @ 2015-08-31 17:18 GadyPu 阅读(191) 评论(0) 推荐(0)
摘要:题目连接http://poj.org/problem?id=3070FibonacciDescriptionIn the Fibonacci integer sequence,F0= 0,F1= 1, andFn=Fn− 1+Fn− 2forn≥ 2. For example, the first ... 阅读全文
posted @ 2015-08-31 16:49 GadyPu 阅读(125) 评论(0) 推荐(0)