数论
文章平均质量分 60
elbadaernu
这个作者很懒,什么都没留下…
展开
-
Dreamoon and WiFi CodeForces - 476B
Dreamoon and WiFi CodeForces - 476B题目描述 Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon’s smartphone and Dreamoon follows them.E原创 2017-02-13 13:23:26 · 559 阅读 · 0 评论 -
HDU 4704 Sum (费马小定理+快速幂+整数和分解+欧拉降幂)
题目:给n(1< n <10^10000),求(s1+s2+s3+…+sn)mod(1e9+7)。其中si表示n由i个数相加而成的种数,如n=4,则s1=1,s2=3。 Input 2 Output 2Hint For N = 2, S(1) = S(2) = 1.The input file consists of multiple test cases. 思路:求n的分解方案原创 2017-08-08 22:59:21 · 377 阅读 · 0 评论 -
FZU 1759-Super A^B mod C (快速幂+欧拉降幂+欧拉函数)
Problem Description Given A,B,C, You should quickly calculate the result of A^B mod C. (1<=A,C<=1000000000,1<=B<=10^1000000).Input There are multiply testcases. Each testcase, there is one line conta原创 2017-08-08 23:53:22 · 298 阅读 · 0 评论 -
2017"百度之星"程序设计大赛 - 初赛(A)1001 小C的倍数问题
Problem Description 根据小学数学的知识,我们知道一个正整数x是3的倍数的条件是x每一位加起来的和是3的倍数。反之,如果一个数每一位加起来是3的倍数,则这个数肯定是3的倍数。现在给定进制P,求有多少个B满足P进制下,一个正整数是B的倍数的充分必要条件是每一位加起来的和是B的倍数。Input 第一行一个正整数T表示数据组数(1<=T<=20)。接下来T行,每行一个正整数P(2 <原创 2017-08-12 17:41:19 · 937 阅读 · 0 评论 -
Biorhythms HDU - 1370 (中国剩余定理)
Some people believe that there are three cycles in a person’s life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have periods o原创 2017-09-07 19:09:37 · 195 阅读 · 0 评论 -
Sum HDU - 4704(隔板法+欧拉降幂+快速幂)
Problem Description Sample Input 2Sample Output 2 HintFor N = 2, S(1) = S(2) = 1.The input file consists of multiple test cases. 大致题意:给你一个数n,s(k)表示将n拆成i个数的方法,让你求s(1)+s(2)+……+s(n)对1e9+7模的值。思路:将原创 2017-09-07 21:30:56 · 275 阅读 · 0 评论 -
Super A^B mod C FZU - 1759(欧拉降幂+快速密码)
Given A,B,C, You should quickly calculate the result of A^B mod C. (1<=A,C<=1000000000,1<=B<=10^1000000).Input There are multiply testcases. Each testcase, there is one line contains three integers A,原创 2017-09-07 21:36:48 · 275 阅读 · 0 评论 -
Visible Lattice Points POJ - 3090 (欧拉函数筛)
A lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other than the origin, is visible from the origin if the line from (0, 0) to (x, y) does not pass through原创 2017-09-07 22:10:03 · 268 阅读 · 0 评论 -
hdu 6216 A Cubic number and A Cubic Number(打表找规律)
Problem Description A cubic number is the result of using a whole number in a multiplication three times. For example, 3×3×3=27 so 27 is a cubic number. The first few cubic numbers are 1,8,27,64 and 1原创 2017-09-17 23:10:25 · 533 阅读 · 0 评论 -
HDU - 3625 Examining the Rooms (第一类Stirling数)
Problem Description A murder happened in the hotel. As the best detective in the town, you should examine all the N rooms of the hotel immediately. However, all the doors of the rooms are locked, and原创 2017-09-27 21:06:37 · 218 阅读 · 0 评论 -
HDU - 4372 Count the Buildings (第一类Stirling数)
Problem Description There are N buildings standing in a straight line in the City, numbered from 1 to N. The heights of all the buildings are distinct and between 1 and N. You can see F buildings when原创 2017-09-27 22:15:55 · 238 阅读 · 0 评论 -
Rank HDU - 2643(第二类Stirling数)
Problem Description Recently in Teddy’s hometown there is a competition named “Cow Year Blow Cow”.N competitors had took part in this competition.The competition was so intense that the rank was chang原创 2017-09-27 22:31:21 · 242 阅读 · 0 评论 -
Mahmoud and Ehab and the xor CodeForces - 862C (异或性质)
Mahmoud and Ehab are on the third stage of their adventures now. As you know, Dr. Evil likes sets. This time he won’t show them any set from his large collection, but will ask them to create a new set原创 2017-09-20 22:44:12 · 314 阅读 · 0 评论 -
Mathematically Hard LightOJ - 1007 (欧拉筛+前缀和)
Mathematically some problems look hard. But with the help of the computer, some problems can be easily solvable.In this problem, you will be given two integers a and b. You have to find the summation o原创 2017-10-28 01:00:54 · 341 阅读 · 0 评论 -
Ifter Party LightOJ - 1014(暴力枚举+set)
I have an Ifter party at the 5th day of Ramadan for the contestants. For this reason I have invited C contestants and arranged P piaju’s (some kind of food, specially made for Ifter). Each contestant a原创 2017-10-30 22:38:53 · 314 阅读 · 0 评论 -
Eid LightOJ - 1024 (枚举质因子+高精度)
In a strange planet there are n races. They are completely different as well as their food habits. Each race has a food-eating period. That means the ith race eats after every xi de-sec (de-sec is the原创 2017-10-31 00:55:32 · 797 阅读 · 0 评论 -
Pocky HDU - 5984 (求期望+推公式+调和级数)
Problem Description Let’s talking about something of eating a pocky. Here is a Decorer Pocky, with colorful decorative stripes in the coating, of length L. While the length of remaining pocky is long原创 2017-11-28 22:40:06 · 1425 阅读 · 0 评论 -
poj1061 青蛙的约会(扩展欧几里德算法)
Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮原创 2017-08-08 17:58:39 · 233 阅读 · 0 评论 -
poj 1830 开关问题(高斯消元)
Description有N个相同的开关,每个开关都与某些开关有着联系,每当你打开或者关闭某个开关的时候,其他的与此开关相关联的开关也会相应地发生变化,即这些相联系的开关的状态如果原来为开就变为关,如果为关就变为开。你的目标是经过若干次开关操作后使得最后N个开关达到一个特定的状态。对于任意一个开关,最多只能进行一次开关操作。你的任务是,计算有多少种可以达到指定状态的方法。(不计开关操作的顺序) In原创 2017-07-31 21:48:11 · 437 阅读 · 0 评论 -
Dreamoon and Sums CodeForces - 476C
Dreamoon and Sums CodeForces - 476C题目描述 思路 数学推公式代码如下#include <iostream> #include <cstdio>#include <cstdlib>#include <fstream>#include <math.h>#include <algorithm>#include <climits>#inclu原创 2017-02-13 18:25:20 · 300 阅读 · 0 评论 -
Little Dima and Equation CodeForces - 460B
Little Dima and Equation CodeForces - 460B题目描述 Little Dima misbehaved during a math lesson a lot and the nasty teacher Mr. Pickles gave him the following problem as a punishment. where a, b, c are so原创 2017-03-22 12:33:22 · 539 阅读 · 0 评论 -
Exam CodeForces - 534A
Exam题目描述 An exam for n students will take place in a long and narrow room, so the students will sit in a line in some order. The teacher suspects that students with adjacent numbers (i and i + 1) alwa原创 2017-03-13 20:08:08 · 901 阅读 · 0 评论 -
Polycarpus' Dice CodeForces - 534C
Polycarpus’ Dice题目描述 Polycarp has n dice d1, d2, …, dn. The i-th dice shows numbers from 1 to di. Polycarp rolled all the dice and the sum of numbers they showed is A. Agrippina didn’t see which dice原创 2017-03-14 21:41:58 · 366 阅读 · 0 评论 -
DZY Loves Modification CodeForces - 446B
DZY Loves Modification CodeForces - 446B题目描述As we know, DZY loves playing games. One day DZY decided to play with a n × m matrix. To be more precise, he decided to modify the matrix with exactly k oper转载 2017-03-23 19:38:17 · 324 阅读 · 0 评论 -
codevs1009 产生数
题目描述 Description 给出一个整数 n(n<10^30) 和 k 个变换规则(k<=15)。 规则: 一位数可变换成另一个一位数: 规则的右部不能为零。 例如:n=234。有规则(k=2): 2-> 5 3-> 6 上面的整数 234 经过变换后可能产生出的整数为(包括原数): 234 534 264原创 2017-05-30 13:40:09 · 498 阅读 · 0 评论 -
codevs1200 同余方程 (2012年NOIP全国联赛提高组)拓展欧几里得
题目描述 Description 求关于 x 同余方程 ax ≡ 1 (mod b)的最小正整数解。 输入描述 Input Description 输入只有一行,包含两个正整数 a, b,用 一个 空格隔开。 输出描述 Output Description 输出只有一行包含一个正整数x0,即最小正整数解,输入数据保证一定有解。样例输入 Sample Input 3 10 样例输出 Sampl原创 2017-05-10 21:09:16 · 351 阅读 · 0 评论 -
codevs 1141 数列(二进制&快速幂)
题目描述 Description 给定一个正整数k(3≤k≤15),把所有k的方幂及所有有限个互不相等的k的方幂之和构成一个递增的序列,例如,当k=3时,这个序列是:1,3,4,9,10,12,13,…(该序列实际上就是:3^0,3^1,3^0+3^1,3^2,3^0+3^2,3^1+3^2,3^0+3^1+3^2,…)请你求出这个序列的第N项的值(用10进制数表示)。例如,对于k=3,N=100原创 2017-05-30 20:31:28 · 627 阅读 · 0 评论 -
codevs1060 搞笑世界杯(dp)
题目描述 Description 随着世界杯小组赛的结束,法国,阿根廷等世界强队都纷纷被淘汰,让人心痛不已. 于是有人组织了一场搞笑世界杯,将这些被淘汰的强队重新组织起来和世界杯一同比赛.你和你的朋友欣然去购买球票.不过搞笑世界杯的球票出售方式也很特别,它们只准备了两种球票.A 类票——免费球票 B 类票——-双倍价钱球票.购买时由工作人员通过掷硬币决定,投到正面的买A类票, 反面的买B类原创 2017-05-30 21:20:15 · 424 阅读 · 0 评论 -
codevs 1250 Fibonacci数列(矩阵快速幂)
题目描述 Description 定义:f0=f1=1, fn=fn-1+fn-2(n>=2)。{fi}称为Fibonacci数列。输入n,求fn mod q。其中1<=q<=30000。输入描述 Input Description 第一行一个数T(1<=T<=10000)。以下T行,每行两个数,n,q(n<=109, 1<=q<=30000)输出描述 Output Description 文原创 2017-05-31 19:29:08 · 323 阅读 · 0 评论 -
codevs1262 不要把球传我
题目描述 Description CCC的足球比赛和传统的足球比赛有一点不同, 一次进球当且仅当先后接触到球的4名队员的球衣编号是升序排列的。球员的球衣编号从过1到99,并且每个人的编号都不同。给出最后得分球员的球衣编号,请计算出有多少合法的球员组合能够产生这一进球。输入描述 Input Description 输入一个整数1<=J<=99,代表进球球员的球衣编号输出描述 Output Desc原创 2017-05-31 20:28:06 · 310 阅读 · 0 评论 -
codevs1353 大神的游戏(快速幂)
题目描述 Description 在那遥远的机房,有一片神奇的格子。为了方便起见,我们编号为1~n。传说只要放入一些卡片,就能实现愿望。卡片一共有m种颜色,但是相邻的格子间不能放入相同颜色的卡片。只要不重复的摆出所有组合,就能召唤出神汉堡 @解决掉你 大神,为你实现梦想。从古书中翻出这个记载的shc同学,便日以夜继的摆起了他的卡片。现在他想知道一共有多少种不同的组合不合法,以便算出愿望实现的那天。原创 2017-05-31 21:28:54 · 313 阅读 · 0 评论 -
codevs 1436 孪生素数 2
题目描述 Description 如m=100,n=6则将输出100以内的所有相差6的孪生素数:如,5 117 13….83 89请按此规律输出数与数之间用半角空格区分,每一对一行.输入描述 Input Description 第一行输入一个整数数m为一个范围(如100)第二行输入一个整数k为目标孪生素数的公差(如6)输出描述 Output Description 每行输出一对,最后一行输出:原创 2017-05-31 21:45:07 · 369 阅读 · 0 评论 -
CodeM美团 初赛A轮 A题 身体训练
美团外卖的配送员用变速跑的方式进行身体训练。 他们训练的方式是:n个人排成一列跑步,前后两人之间相隔 u 米,每个人正常速度均为 v 米/秒。 当某个配送员排在最后的时候,他需要以当时自己的最高速度往前跑,直到超过排头的人 u 米,然后降回到原始速度 v 米/秒。每个人最初的最高速度为c[i] 米/秒,每轮衰减d[i] 米/秒,也就是说,如果i是第j个跑的,那么他的速度就是c[i]-(j-1)*原创 2017-06-19 00:14:44 · 1207 阅读 · 2 评论 -
hdu 3364 Lanterns (高斯消元)
Problem Description Alice has received a beautiful present from Bob. The present contains n lanterns and m switches. Each switch controls some lanterns and pushing the switch will change the state of原创 2017-07-31 09:20:43 · 359 阅读 · 0 评论 -
UVA 11029 Leading and Trailing
You are given two integers: n and k, your task is to find the most significant three digits, and least significant three digits of n^k.Input Input starts with an integer T (≤ 1000), denoting the numbe原创 2017-07-19 12:58:37 · 187 阅读 · 0 评论 -
Non-square Equation CodeForces - 233B (数学)
Let’s consider equation:x2 + s(x)·x - n = 0, where x, n are positive integers, s(x) is the function, equal to the sum of digits of number x in the decimal number system.You are given an integer ...原创 2017-11-29 22:21:57 · 314 阅读 · 0 评论