快速幂
楚江枫
不忘初心,方得始终
展开
-
【POJ 3641】Pseudoprime numbers
Pseudoprime numbersDescriptionFermat’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 is a.原创 2016-07-23 13:57:00 · 335 阅读 · 0 评论 -
【POJ 3641】Pseudoprime numbers
Pseudoprime numbersDescriptionFermat’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 is a.原创 2016-07-24 22:32:31 · 331 阅读 · 0 评论 -
【POJ 1995】Raising Modulo Numbers
Raising Modulo NumbersDescriptionPeople are different. Some secretly read magazines full of interesting girls’ pictures, others create an A-bomb in their cellar, others like using Windows, and some lik原创 2016-07-24 22:35:01 · 365 阅读 · 0 评论 -
【HDU杭电 2035】人见人爱A^B
人见人爱A^BProblem Description 求A^B的最后三位数表示的整数。 说明:A^B的含义是“A的B次方”Input 输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=0, B=0,则表示输入数据的结束,不做处理。Output 对于每个测试实例,请输出A^B的最后三位表示的整数,每个输出占一行。Sample Input原创 2016-07-24 22:37:29 · 308 阅读 · 0 评论 -
【HDU 杭电 1061】 Rightmost Digit
Rightmost DigitProblem Description Given a positive integer N, you should output the most right digit of N^N.Input The input contains several test cases. The first line of the input is a single integ原创 2016-07-24 22:40:58 · 442 阅读 · 0 评论 -
【Lightoj 1282 Leading and Trailing】
Leading and TrailingYou are given two integers: n and k, your task is to find the most significant three digits, and least significant three digits of nk.Input Input starts with an integer T (≤ 1000),原创 2016-08-23 21:34:12 · 372 阅读 · 0 评论 -
【HDU 4506 小明系列故事——师兄帮帮忙】+ 找规律
小明系列故事——师兄帮帮忙 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 5529 Accepted Submission(s): 1495Problem Description 小明自从告别了ACM/ICPC之后,就开始原创 2016-10-25 19:56:56 · 438 阅读 · 0 评论 -
【Lightoj 1067】+ 逆元 + 预处理
Given n different objects, you want to take k of them. How many ways to can do it?For example, say there are 4 items; you want to take 2 of them. So, you can do it 6 ways.Take 1, 2 Take 1, 3 Take 1,原创 2016-10-02 18:06:11 · 440 阅读 · 0 评论 -
【Codeforces 809 A. Do you want a date?】
A. Do you want a date? time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Leha decided to move to a quiet town Vičkopolis, because he was tir原创 2017-05-22 12:27:12 · 929 阅读 · 0 评论