• 博客(70)
  • 资源 (1)
  • 论坛 (1)
  • 收藏
  • 关注

原创 三角形

题目描述小明有一根长度为a的木棒,现在小明想将木棒分为多段(每段木棒长度必须为整数),使得分隔后的木棍中,取出的任意三段都不能构成三角形,小明想知道木棒最多被分成几段?输入描述:输入数据的第一行是t,表示数据的组数, 接下来每组数据输入一个a(t<=1000, 1 <= a < 2^64 - 1)输出描述:对于每组输入样例,打印木棒最多被分为多少段示例1输入213输出12#pragma GCC optimize(2).

2020-05-31 21:45:03 98

原创 Ice Rain

对于上述式子可以化简为 k%i==k-k/i*i及计算 n*k-k/i*i 的值(其中i从1取值到n)因为i为整除,所以一定存在一个区间【l,r】使 k/i 的值相同这便是这个题目的优化处当然根据上式,因为i为整除,所以当 i>k时,k/i=0所以枚举 l 的值可提取的公因数 d=(k/l),则 r=(k/d)(此时k一定可以被d整除)最后利用等差数列求和公式计算【l,r】的值就可以了

2020-05-31 19:30:03 45

原创 Beijing 2008(不使用逆元解决除数求余)

题目要求计算2008的m次方mod km为2008的n次方所有除数和首先将2008分解为8*251即可以转化成 2^3^n*251^n利用等比数列求和公式求出他们的除数和 div1=2^3^n=2^3^(n+1)-1 , div2=251^n=(251)^(n+1)-1这样可以运用快速幂求解但是div2涉及到除法求余运算,所以考虑逆元,因为无法确定k是否与250互素所以采用 x/d%m = x%(d*m)/d 进行求解,即将 mod k改为 mod(k*250)

2020-05-31 19:29:35 61

原创 N!Again(同余定理)

WhereIsHeroFrom: Zty, what are you doing ?Zty: I want to calculate N!......WhereIsHeroFrom: So easy! How big N is ?Zty:1 <=N <=100000000000000000000000...

2020-05-31 19:28:05 74

原创 I wont tell you this is about number theory(结论)

To think of a beautiful problem description is so hard for me that let's just drop them off. :)Given four integers a,m,n,k,and S = gcd(a^m-1,a^n-1)%k,calculate the S.InputThe first line contain a t,then t cases followed.Each case contain four in...

2020-05-31 19:27:31 68

转载 Central Meridian Number

https://www.cnblogs.com/javaspring/archive/2012/02/16/2656406.html#pragma GCC optimize(2)#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>#define rush() int T;cin>>T;while(T--)#define go(a).

2020-05-31 19:25:25 67

原创 Romantic

The Sky is Sprite.The Birds is Fly in the Sky.The Wind is Wonderful.Blew Throw the TreesTrees are Shaking, Leaves are Falling.Lovers Walk passing, and so are You.................................Write in English class by yifenfeiGirls are clever a...

2020-05-31 19:24:39 46

原创 Number Sequence

#include <iostream>#include <algorithm>#include <cstring>#include <cstdio>#include <vector>#define rush() int T;cin>>T;while(T--)#define go(a) while(cin>>a)#define ms(a,b) memset(a,b,sizeof a)#define E 1e-8

2020-05-31 19:24:04 47

原创 七夕节


2020-05-31 19:22:28 62

原创 The number of divisors(约数) about Humble Numbers

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, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first 20 humble numbers.Now given a humble number, please write a program to calc

2020-05-31 19:21:39 50

原创 Code obfuscation

Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest.To obfuscate the code, Kostya fi

2020-05-30 22:40:00 37

原创 GCD Again

Do you have spent some time to think and try to solve those unsolved problem after one ACM contest?No? Oh, you must do this when you want to become a "Big Cattle".Now you will find that this problem is so familiar:The greatest common divisor GCD (a, ...

2020-05-30 14:54:06 50

原创 Calculation(指数循环节,欧拉函数的常用公式)

Assume that f(0) = 1 and 0^0=1. f(n) = (n%10)^f(n/10) for all n bigger than zero. Please calculate f(n)%m. (2 ≤ n , m ≤ 10^9, x^y means the y th power of x).InputThe first line contains a single positive integer T. which is the number of test cases....

2020-05-30 14:44:27 113

原创 A.Game Outcome(水题)

Sherlock Holmes and Dr. Watson played some game on a checkered boardn × nin size. During the game they put numbers on the board's squares by some tricky rules we don't know. However, the game is now over and each square of the board contains exactly one ..

2020-05-29 23:26:53 98

原创 C.Books Queries(思维+寻找元素位置)

You have got a shelf and want to put some books on it.You are givenqqqueries of three types:Lidid— put a book having indexididon the shelf to the left from the leftmost existing book; Ridid— put a book having indexididon the shelf to the rig...

2020-05-29 23:00:04 64

原创 Buns

Lavrenty, a baker, is going to make several buns with stuffings and sell them.Lavrenty hasngrams of dough as well asmdifferent stuffing types. The stuffing types are numerated from 1 tom. Lavrenty knows that he hasaigrams left of thei-th stuffin...

2020-05-29 21:24:31 61

原创 Cashier(水)

Vasya has recently got a job as a cashier at a local store. His day at work is L minutes long. Vasya has already memorized n regular customers, the i-th of which comes after ti minutes after the beginning of the day, and his service consumes liminutes. .

2020-05-29 01:16:21 57

原创 Block Towers (思维)

Students in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces made of two blocks and m of the students use pieces made of three blocks.The students

2020-05-28 23:46:28 105

原创 HDU 2824 The Euler function(裸题)

在 1,2,3,……,p^k 这些数中,与p^k互质的数就是不能整除p的数,p 的倍数只有 p,2p,3p.....p^(k-1) 这 p^(k-1) 个数,所以 。

2020-05-28 15:25:51 78

原创 GCD

题意:求1<= i <= n 且 gcd(i,n)>= m 的 i 的个数根据题目要求:对于 i=gcd*a , n=gcd*b若 a,b互质,gcd>=m,则满足题目要求所以求出 b 的欧拉函数的值即可

2020-05-28 14:49:43 99

原创 埃始筛法优化质因数分解

//#pragma GCC optimize(2)#include <bits/stdc++.h>#define rush() int T;cin>>T;while(T--)#define go(a) while(cin>>a)#define ms(a,b) memset(a,b,sizeof a)#define E 1e-8using namespace std;typedef long long ll;const int inf=0x3f3f3f3f.

2020-05-25 18:53:16 72

原创 Codeforces Round #644 (Div. 3)

A. Minimal Square #pragma GCC optimize(2) #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #include <cmath> #include <set> #define rush() int T;cin>&g.

2020-05-25 07:41:53 61

转载 f(n)(挺难的一道规律题)

This time I need you to calculate the f(n) . (3<=n<=1000000)f(n)= Gcd(3)+Gcd(4)+…+Gcd(i)+…+Gcd(n).Gcd(n)=gcd(C[n][1],C[n][2],……,C[n][n-1])C[n][k] means the number of way to choose k things from n some things.gcd(a,b) means the greatest common div

2020-05-23 22:48:58 95

原创 求第k大公约数

In mathematics, the greatest common divisor (gcd), also known as the greatest common factor (gcf), highest common factor (hcf), or greatest common measure (gcm), of two or more integers (when at least one of them is not zero), is the largest positive in...

2020-05-23 15:37:48 64

转载 本源串

由0和1组成的串中,不能表示为由几个相同的较小的串连接成的串,称为本原串,有多少个长为n(n<=100000000)的本原串?答案mod2008.例如,100100不是本原串,因为他是由两个100组成,而1101是本原串。Input输入包括多个数据,每个数据一行,包括一个整数n,代表串的长度。Output对于每个测试数据,输出一行,代表有多少个符合要求本原串,答案mod2008.Sample Input1234Sample Output2261...

2020-05-23 11:30:13 48

转载 Light It Up

Recently, you bought a brand new smart lamp with programming features. At first, you set up a schedule to the lamp. Every day it will turn power on at moment00and turn power off at momentMM. Moreover, the lamp allows you to set a program of switching...

2020-05-23 09:02:47 91

原创 Almost Arithmetic Progression

Polycarp likes arithmetic progressions. A sequence[a1,a2,…,an][a1,a2,…,an]is called an arithmetic progression if for eachii(1≤i<n1≤i<n) the valueai+1−aiai+1−aiis the same. For example, the sequences[42][42],[5,5,5][5,5,5],[2,11,20,29][2,11,2...

2020-05-23 08:19:06 49

原创 Relatively Prime Graph (暴力)

Let's call an undirected graph G=(V,E) relatively prime if and only if for each edge (v,u)∈E GCD(v,u)=1 (the greatest common divisor of v and u is 1). If there is no edge between some pair of vertices v and u then the value of GCD(v,u) doesn't matter. Th..

2020-05-22 17:59:16 63

原创 虚继承(animal)

描述长期的物种进化使两栖动物既能活跃在陆地上,又能游动于水中。利用虚基类建立一个类的多重继承,包括动物(animal,属性有体长,体重和性别),陆生动物(ter_animal,属性增加了奔跑速度),水生动物(aqu_animal,属性增加了游泳速度)和两栖动物(amp_animal)。其中两栖动物保留了陆生动物和水生动物的属性。要求: animal只有带参的构造函数。其他函数根据需要自行设置输入两栖动物的体长,体重,性别,游泳速度,奔跑速度(running_speed)输出初始.

2020-05-22 09:13:06 104

原创 Robot Breakout (思维)

题意:有 nnn 个机器人在一个平面上,第 iii 个机器人的位置是 (Xi,Yi)(X_i,Y_i)(Xi​,Yi​)。在设计的时候,第 iii 个机器人可以执行的操作: 位置从 (Xi,Yi)(X_i,Y_i)(Xi​,Yi​) 变为 (Xi−1,Yi)(X_i-1,Y_i)(Xi​−1,Yi​)。 位置从 (Xi,Yi)(X_i,Y_i)(Xi​,Yi​) 变为 (Xi,Yi+1)(X_i,Y_i+1)(Xi​,Yi​+1)。 位置从 (Xi,Yi)(X_i,Y_..

2020-05-21 15:10:07 45

转载 Mentors (lower_bound)

In BerSoft n programmers work, the programmer i is characterized by a skill ri.A programmer acan be a mentor of a programmer b if and only if the skill of the programmer a is strictly greater than the skill of the programmer b (ra>rb) and program.

2020-05-21 11:40:45 37

原创 ConneR and the A.R.C. Markland-N

A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, there is a staircase connecting them.It's lunchtime for our sensei Colin "ConneR" Neumann Jr, and he's planning for a location t.

2020-05-21 11:08:54 58

原创 Points and Powers of Two (数学)

There arenndistinct points on a coordinate line, the coordinate ofii-th point equals toxixi. Choose a subset of the given set of points such that the distance between each pair of points in a subset is an integral power of two. It is necessary to consi...

2020-05-21 08:44:02 55

原创 第12周训练总结


2020-05-17 23:22:21 74

原创 Bus System (dij)

Because of the huge population of China, public transportation is very important. Bus is an important transportation method in traditional public transportation system. And it’s still playing an important role even now.The bus system of City X is quite...

2020-05-16 09:01:21 80

转载 Here We Go(relians) Again (dijkstra)

The Gorelians are a warlike race that travel the universe conquering new worlds as a form of recreation. Given their violent, fun-loving nature, keeping their leaders alive is of serious concern. Part of the Gorelian security plan involves changing the tra

2020-05-15 23:38:21 61

原创 Codeforces Round #642 (Div. 3)

A. Most Unstable Array #pragma GCC optimize(2) #include <bits/stdc++.h> #define rush() int T;cin>>T;while(T--) #define go(a) while(cin>>a) #define ms(a,b) memset(a,b,sizeof a) #define sdd(a,b) scanf("%d%d",&..

2020-05-15 13:14:16 79

原创 Largest prime factor

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 position of prime 2 is 1, prime 3 is 2, and prime 5 is 3, etc.Specially, LPF(1) = 0.InputEach line will conta...

2020-05-14 22:23:14 86

原创 Date_Time(多继承)

描述1、定义日期“Date”类,类中包含数据成员年、月、日,成员函数包括构造函数(只有带参的构造函数),设置日期,或取年、月、日,显示年、月、日等2、定义时间“Time”类,数据成员包括时分秒。成员函数的要求同date类3、定义日期时间型“Date_Time”类⑴公有继承Date类及Time类;⑵不增加数据成员;⑶增加日期时间处理成员函数,包括初始化日期时间、设置日期时间、显示日期时间等。在4、每个类都要求重载>> 和<<运算符< span=...

2020-05-14 21:43:44 231

原创 Jungle Roads

The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so the large road network is too expensive to maintain....

2020-05-14 16:00:03 88


适合新手使用的编译器,之后更新 百度网盘安装包: 链接:https://pan.baidu.com/s/1M1PGcirlC0He1WjOFrw8gQ 提取码:jfq5



发表于 2019-11-18 最后回复 2019-11-18


TA创建的收藏夹 TA关注的收藏夹

TA关注的人 TA的粉丝

取消 删除