![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
文章平均质量分 77
尉水风
这个作者很懒,什么都没留下…
展开
-
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 te原创 2017-11-21 18:49:14 · 196 阅读 · 0 评论 -
蓝桥—ALGO-2 最大最小公倍数
算法训练 最大最小公倍数 问题描述 已知一个正整数N,问从1~N中任选出三个数,他们的最小公倍数最大可以为多少。 输入格式 输入一个正整数N。 输出格式 输出一个整数,表示你找到的最小公倍数。 样例输入 9 样例输出 504 数据规模与约定 1 6。 这道题目虽然说是贪心,但是要用到一些数论的东西 算术基本原创 2018-01-27 10:36:15 · 286 阅读 · 0 评论 -
Happy 2004
Happy 2004 Problem Description Consider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your job is to determine S modulo 29 (the rest of the division of原创 2017-12-17 21:56:02 · 277 阅读 · 0 评论 -
七夕节
七夕节 Problem Description 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!" 人们纷纷来到告示前,都想知道谁才是自己的另一半.告示如下: 数字N的因子就是所有比N小又能被N整除的所有正整数,如12的因子有1,2,3,4,6. 你想知道你的另一半吗?原创 2017-12-17 21:41:59 · 236 阅读 · 0 评论 -
The number of divisors(约数) about Humble Numbers
The number of divisors(约数) about Humble Numbers Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14原创 2017-12-17 21:39:42 · 188 阅读 · 0 评论 -
Recurrences
这个题目需要构造矩阵,我是这样构造的: ,剩下的就是矩阵快速幂,注意一点数据在取模之后还是能超int #include #include typedef struct Matrix { long long M[20][20]; Matrix() { memset(M,0,sizeof(M)); } }Matrix; Matrix M_multi(Matrix a,Matrix b,i原创 2017-11-25 21:13:43 · 386 阅读 · 0 评论 -
Matrix Power Series
Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak. Input The input contains exactly one test case. The first line of input contains three positive integers原创 2017-11-22 11:07:38 · 413 阅读 · 0 评论 -
Plant
Dwarfs have planted a very interesting plant, which is a triangle directed "upwards". This plant has an amusing feature. After one year a triangle plant directed "upwards" divides into four triangle p原创 2017-11-24 19:32:59 · 253 阅读 · 0 评论 -
Largest prime factor
Largest prime factor Problem Description Everybody knows any number can be combined by the prime number. Now, your task is telling me what position of the largest prime factor. The positio原创 2017-12-12 18:46:55 · 240 阅读 · 0 评论 -
Fibonacci Check-up
Fibonacci Check-up Problem Description Every ALPC has his own alpc-number just like alpc12, alpc55, alpc62 etc. As more and more fresh man join us. How to number them? And how to avoid their al原创 2017-11-23 16:45:32 · 241 阅读 · 0 评论 -
Fibonacci
In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, … An alterna原创 2017-11-23 14:43:26 · 838 阅读 · 0 评论 -
Tr A
A为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973。 Input数据的第一行是一个T,表示有T组数据。 每组数据的第一行有n(2 Output对应每组数据,输出Tr(A^k)%9973。 Sample Input 2 2 2 1 0 0 1 3 99999999 1 2 3 4 5 6 7 8 9 Sample Outpu原创 2017-11-21 20:10:01 · 1021 阅读 · 0 评论 -
gcd和扩展gcd
//求解ax+my=1 int exGCD(int a,int b,int &x,int &y) { if(b==0) { x=1; y=0; return a; } int g=exGCD(b,a%b,x,y); int tmp=x; x=y; y=tmp-a/b*y; return g; } int gcd(int a,int b) { if...原创 2018-05-24 18:54:55 · 349 阅读 · 0 评论