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 t...

2018-05-24 18:54:55

阅读数:55

评论数:0

蓝桥—ALGO-2 最大最小公倍数

算法训练 最大最小公倍数   问题描述 已知一个正整数N,问从1~N中任选出三个数,他们的最小公倍数最大可以为多少。 输入格式 输入一个正整数N。 输出格式 输出一个整数,表示你找到的最小公倍数。 样例输入 9 样例输出 504 数...

2018-01-27 10:36:15

阅读数:94

评论数: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 ...

2017-12-17 21:56:02

阅读数:87

评论数:0

七夕节

七夕节 Problem Description 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!" 人们纷纷来到告示前,都想知道谁才是自己的另一半.告示如下: ...

2017-12-17 21:41:59

阅读数:89

评论数: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....

2017-12-17 21:39:42

阅读数:88

评论数: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...

2017-12-12 18:46:55

阅读数:84

评论数:0

Recurrences

这个题目需要构造矩阵,我是这样构造的: ,剩下的就是矩阵快速幂,注意一点数据在取模之后还是能超int #include #include typedef struct Matrix { long long M[20][20]; Matrix() { memset(M,0,sizeof(...

2017-11-25 21:13:43

阅读数:113

评论数: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 t...

2017-11-24 19:32:59

阅读数:100

评论数: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 joi...

2017-11-23 16:45:32

阅读数:104

评论数: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 a...

2017-11-23 14:43:26

阅读数:102

评论数: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 ...

2017-11-22 11:07:38

阅读数:113

评论数: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...

2017-11-21 20:10:01

阅读数:126

评论数: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 in...

2017-11-21 18:49:14

阅读数:85

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭