![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
风去幽墨
当你为自己的未来踏踏实实地努力时,那些你从未见过的风景正一步步向你走来
展开
-
POJ-1061-青蛙的约会 (扩展欧几里得算法)
原题链接: http://poj.org/problem?id=1061 两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在...原创 2018-11-17 21:21:35 · 125 阅读 · 0 评论 -
LightOJ-1070- Algebraic Problem (矩阵快速幂)
原题链接: Given the value of a+b and ab you will have to find the value of an+bn. a and b not necessarily have to be real numbers. Input Input starts with an integer T (≤ 10000), denoting the number of te...原创 2018-12-09 14:49:13 · 146 阅读 · 0 评论 -
HDU-4686-Arc of Dream (矩阵快速幂)
原题链接: An Arc of Dream is a curve defined by following function: where a 0 = A0 a i = a i-1AX+AY b 0 = B0 b i = b i-1BX+BY What is the value of AoD(N) modulo 1,000,000,007? Input There are multiple te...原创 2018-12-09 14:40:03 · 128 阅读 · 0 评论 -
HDU-1005-Number Sequence (循环周期)
原题链接: A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. Given A, B, and n, you are to calculate the value of f(n). Input The input consists of mu...原创 2018-12-09 14:21:47 · 156 阅读 · 0 评论 -
POJ-1845-Sumdiv (唯一分解定理、快速幂、费马小定理)
原题链接: Consider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901). Input The only line contains the two natur...原创 2018-12-09 14:15:14 · 146 阅读 · 0 评论 -
HDU-5685-Problem A (费马小定理)
原题链接: 度熊手上有一本字典存储了大量的单词,有一次,他把所有单词组成了一个很长很长的字符串。现在麻烦来了,他忘记了原来的字符串都是什么,神奇的是他竟然记得原来那些字符串的哈希值。一个字符串的哈希值,由以下公式计算得到: H(s)=∏i≤len(s)i=1(Si−28) (mod 9973) Si代表 S[i] 字符的 ASCII 码。 请帮助度熊计算大字符串中任意一段的哈希值是多少。 Inpu...原创 2018-12-07 16:49:31 · 203 阅读 · 2 评论 -
LighttOJ-1067-Combinations (费马小定理)
原题链接: 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 T...原创 2018-12-07 16:37:40 · 127 阅读 · 0 评论 -
HDU-2669-Romantic (扩展欧几里得算法)
原题链接: http://acm.hdu.edu.cn/showproblem.php?pid=2669 The Sky is Sprite. The Birds is Fly in the Sky. The Wind is Wonderful. Blew Throw the Trees Trees are Shaking, Leaves are Falling. Lovers Walk pass...原创 2018-12-02 12:50:57 · 231 阅读 · 0 评论 -
LightOJ-1336-Sigma Function (算术基本定理)
原题链接: Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a number. For example σ(24) = 1...原创 2018-12-02 12:21:07 · 212 阅读 · 0 评论 -
LIghtOJ-1341-Aladdin and the Flying Carpet (唯一分解定理)
原题链接: It’s said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery. Aladdin was about to enter to a...原创 2018-12-02 11:54:29 · 134 阅读 · 0 评论 -
LightOJ-1236- Pairs Forming LCM (算术基本定理)
原题链接: Find the result of the following code: long long pairsFormLCM( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) for( int j = i; j <= n; j++ ) if( lcm(i, j) == n ) res++; // lcm m...原创 2018-12-02 11:23:59 · 179 阅读 · 0 评论 -
LightOJ-1197 -Help Hanzo (素数)
原题链接: Amakusa, the evil spiritual leader has captured the beautiful princess Nakururu. The reason behind this is he had a little problem with Hanzo Hattori, the best ninja and the love of Nakururu. Af...原创 2018-12-02 10:54:15 · 193 阅读 · 0 评论 -
POJ-2262-Goldbach`s Conjecture (素数)
原题链接: Goldbach’s conjecture is one of the oldest unsolved problems in number theory and in all of mathematics. It states: Every even integer, greater than 2, can be expressed as the sum of two primes ...原创 2018-12-02 10:30:09 · 172 阅读 · 0 评论 -
POJ-2142-The Balance (扩展欧几里得算法)
原题链接: Ms. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine. For example, to measure 200mg of aspirin using 300mg weights and 700mg weights, she can put one...原创 2018-12-07 16:26:41 · 183 阅读 · 0 评论