- 博客(85)
- 收藏
- 关注
转载 整数划分
将正整数n表示成一系列正整数之和:n=n1+n2+…+nk,其中n1≥n2≥…≥nk≥1,k≥1#include<bits/stdc++.h> using namespace std; int dp[15][15]; int main() { int n,m,i,j,t; dp[1][1]=1; fo...
2019-09-25 23:21:00
167
转载 C. Substring Game in the Lesson ( Codeforces Round #586 (Div. 1 + Div. 2) )
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a stringssand a numberkk...
2019-09-25 22:13:00
225
转载 B. Multiplication Table ( Codeforces Round #586 (Div. 1 + Div. 2) )
Sasha grew up and went to first grade. To celebrate this event her mother bought her a multiplication tableMMwithnnrows andnncolumns such thatMij=ai⋅ajMij=ai⋅ajwherea1,…,ana1...
2019-09-25 19:46:00
288
转载 A. Cards (Codeforces Round #586 (Div. 1 + Div. 2))
When Serezha was three years old, he was given a set of cards with letters for his birthday. They were arranged into words in the way which formed the boy's mother favorite number in binary not...
2019-09-25 19:45:00
218
转载 红与黑 《BFS》
有一间长方形的房子,地上铺了红色、黑色两种颜色的正方形瓷砖。你站在其中一块黑色的瓷砖上,只能向相邻的黑色瓷砖移动。请写一个程序,计算你总共能够到达多少块黑色的瓷砖。Input包括多个数据集合。每个数据集合的第一行是两个整数W和H,分别表示x方向和y方向瓷砖的数量。W和H都不超过20。在接下来的H行中,每行包括W个字符。每个字符表示一块瓷砖的颜色,规则如下1)‘.’:黑色的瓷砖;2)‘...
2019-09-25 17:44:00
286
转载 Find The Multiple 《DFS》
Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and ...
2019-09-25 17:02:00
105
转载 C. Anadi and Domino 《 Codeforces Round #588 (Div. 2) 》
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For everyaaandbbsuch that1≤a≤b≤61≤a≤b≤6, there is exactly one domino withaadots on on...
2019-09-24 23:03:00
131
转载 E1 - Numerical Sequence (easy version) 《 Codeforces Round #587 (Div. 3) 》
The only difference between the easy and the hard versions is the maximum value ofkk.You are given aninfinitesequence of form "112123123412345……" which consist of blocks of...
2019-09-24 21:09:00
202
转载 A. Dawid and Bags of Candies ( Codeforces Round #588 (Div. 2) )
Dawid has four bags of candies. Theii-th of them containsaiaicandies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute...
2019-09-24 12:56:00
278
转载 B. Ania and Minimizing (Codeforces Round #588 (Div. 2) )
Ania has a large integerSS. Its decimal representation has lengthnnand doesn't contain any leading zeroes. Ania is allowed to change at mostkkdigits ofSS. She wants to d...
2019-09-24 12:53:00
350
转载 残缺的棋盘 (BFS)
在国际象棋里,王是最重要的一个棋子。每一步,王可以往上下左右或者对角线方向移动一步,如下图所示给定两个格子A(r1c1) B(r2c2),你的任务是计算出一个王从A到B至少需要走多少步。为了避免题目太简单,我们从棋盘里拿掉了一个格子C(r3c3)(ABC保证互不相同),要求王从A走到B的过程中不能进入格子C。在本题中,各行从上到下编号为1~8,各列从左到右编...
2019-09-23 23:23:00
212
转载 Max Sum (动态规划)
Given a sequence a[1]a[2]a[3]......a[n] your job is to calculate the max sum of a sub-sequence. For example given (6-154-7) the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.InputThe ...
2019-09-22 16:37:00
405
转载 高桥和低桥 (离散化 )
有个脑筋急转弯是这样的:有距离很近的一高一低两座桥,两次洪水之后高桥被淹了两次,低桥却只被淹了一次,为什么?答案是:因为低桥太低了,第一次洪水退去之后水位依然在低桥之上,所以不算“淹了两次”。举例说明:假定高桥和低桥的高度分别是5和2,初始水位为1第一次洪水:水位提高到6(两个桥都被淹),退到2(高桥不再被淹,但低桥仍然被淹)第二次洪水:水位提高到8(高桥又被淹了),退到3。...
2019-09-22 16:36:00
319
转载 White Sheet (矩形面积模板) (Codeforces Round #587 (Div. 3) )
There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel to the sides of the table. If you will take a look from above and assume t...
2019-09-22 08:16:00
315
转载 Catch That Cow (BFS luo搜 + 剪枝)
Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a pointN(0 ≤N≤ 100,000) on a number line and the cow is at a pointK(0 ≤K...
2019-09-21 14:27:00
127
转载 Dungeon Master (luo 三维 BFS )
You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, ...
2019-09-21 09:59:00
99
转载 迷宫问题 (最短路径保存输出)
定义一个二维数组:int maze[5][5] = {0, 1, 0, 0, 0,0, 1, 0, 1, 0,0, 0, 0, 0, 0,0, 1, 1, 1, 0,0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。...
2019-09-20 19:27:00
884
转载 Aggressive cows (北京大学ACM-ICPC竞赛训练暑期课 )
描述Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi <= 1,000,000,000).His C (2 <...
2019-09-19 22:54:00
119
转载 滑雪 (北京大学ACM-ICPC竞赛训练暑期课 )
描述Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长的滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 ...
2019-09-19 22:50:00
154
转载 棋盘问题 (北京大学ACM-ICPC竞赛训练暑期课 )
描述在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。输入输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n当为...
2019-09-19 22:46:00
228
转载 简单的整数划分问题 ( 北京大学ACM-ICPC竞赛训练暑期课 )
描述将正整数n表示成一系列正整数之和,n=n1+n2+…+nk,其中n1>=n2>=…>=nk>=1,k>=1。正整数n的这种表示称为正整数n的划分。正整数n的不同的划分个数称为正整数n的划分数。输入标准的输入包含若干组测试数据。每组测试数据是一个整数N(0 < N <= 50)。输出对于每组测试数据,输出N的划分数。...
2019-09-19 22:42:00
211
转载 马走日 (DFS)
马在中国象棋以日字形规则移动。请编写一段程序,给定n*m大小的棋盘,以及马的初始位置(x,y),要求不能重复经过棋盘上的同一个点,计算马可以有多少途径遍历棋盘上的所有点。Input第一行为整数T(T < 10),表示测试数据组数。每一组测试数据包含一行,为四个整数,分别为棋盘的大小以及初始位置坐标n,m,x,y。(0<=x<=n-1,0<=y<=m...
2019-09-18 23:18:00
246
转载 蓝桥杯 (计算路径)
题意:7*7的矩阵,出发点和终点都是0,0 ,问有多少条路径,步数不超过12步。考虑的边界值不仅仅是迷宫边界,还有最少步数,所有的限制条件都要考虑#include <iostream>#include <algorithm>#include <cstdio>#include <string>#include ...
2019-09-18 20:04:00
343
转载 最长单词 (分割字符串)(蓝桥杯-算法提高)
编写一个函数,输入一行字符,将此字符串中最长的单词输出。输入仅一行,多个单词,每个单词间用一个空格隔开。单词仅由小写字母组成。所有单词的长度和不超过100000。如有多个最长单词,输出最先出现的。Input无Output无Sample InputcopyI am a studentS...
2019-09-18 09:06:00
235
转载 彩票 (蓝桥杯~算法提高 )
为丰富男生节活动,贵系女生设置彩票抽奖环节,规则如下:1、每张彩票上印有7个各不相同的号码,且这些号码的取值范围为[1, 33];2、每次在兑奖前都会公布一个由七个互不相同的号码构成的中奖号码;3、共设置7个奖项,特等奖和一等奖至六等奖。兑奖规则如下:特等奖:要求彩票上的7个号码都出现在中奖号码中;一等奖:要求彩票上的6个号码出现在中奖号码中;二等奖:要求彩票上的5个号码出现在中奖号码中...
2019-09-17 23:43:00
843
转载 我们的征途是星辰大海 ( 蓝桥杯~算法提高 )
最新的火星探测机器人curiosity被困在了一个二维迷宫里,迷宫由一个个方格组成。共有四种方格:‘.’ 代表空地,curiosity可以穿过它‘#’ 代表障碍物,不可穿越,不可停留‘S’ 代表curiosity的起始位置‘T’ 代表curiosity的目的地NASA将会发送一系列的命令给curiosity,格式如下:“LRUD”分别代表向左,向右,向上,向下走一步。由于地球...
2019-09-17 23:28:00
185
转载 寻找三位数 (蓝桥杯~算法提高)
将1,2,…,9共9个数分成三组,分别组成三个三位数,且使这三个三位数构成 1:2:3的比例,试求出所有满足条件的三个三位数。例如:三个三位数192,384,576满足以上条件。Input无Output输出每行有三个数,为满足题设三位数。各行为满足要求的不同解。int main(){ for(int i=123;i<...
2019-09-17 22:46:00
744
转载 Gunner II (离散化 map + set ) HDU 5233
Problem DescriptionLong long ago, there was a gunner whose name is Jack. He likes to go hunting very much. One day he go to the grove. There are n birds and n trees. The i-th bird stands on the...
2019-09-16 22:09:00
162
转载 B Light bulbs (离散化+暴力)(The Preliminary Contest for ICPC Asia Shanghai 2019)
There areNNlight bulbs indexed from00toN-1N−1. Initially, all of them are off.A FLIP operation switches the state of a contiguous subset of bulbs.FLIP(L, R)FLIP(L,R)means to flip all b...
2019-09-16 22:07:00
127
转载 A.签到题 (公约数||公倍数) (Comet OJ - Contest #7)
题目描述多次询问,每次询问给一个值域范围[l,r][l,r],要回答下列四个问题:从这个范围内选出两个整数(两个数可相同),(1) 这两个数的最小公倍数最大是多少?(2) 这两个数的最小公倍数最小是多少?(3) 这两个数的最大公约数最大是多少?(4) 这两个数的最大公约数最小是多少?输入描述第一行一个数tt...
2019-09-16 22:03:00
113
转载 Digit sum 打表签到(The Preliminary Contest for ICPC Asia Shanghai 2019)
A digit sumS_b(n)Sb(n)is a sum of the base-bbdigits ofnn. Such asS_{10}(233) = 2 + 3 + 3 = 8S10(233)=2+3+3=8,S_{2}(8)=1 + 0 + 0 = 1S2(8)=1+0+0=1,S_{2}(7)=1 + 1 + 1 = 3S2(7)=1+1+1=...
2019-09-16 16:08:00
113
转载 K:Guanguan's Happy water (The Preliminary Contest for ICPC Asia Shenyang 2019)
Rather than drinking happy water, Guanguan loves storing happy water. So he bought a refrigerator and storeda_iaibottles of cola into it every day. When the storage is finished on thekk-th ...
2019-09-14 21:52:00
173
转载 F:Honk's pool (The Preliminary Contest for ICPC Asia Shenyang 2019)
As we all know, Honk hasnnpools, numbered as11~nn. There isa_iailiters water in theii-th pool. Every day, Honk will perform the following operations in sequence.Find the pool wi...
2019-09-14 21:15:00
92
转载 C:Dawn-K's water (The Preliminary Contest for ICPC Asia Shenyang 2019)
Dawn-K recently discovered a very magical phenomenon in the supermarket of Northeastern University: The large package is not necessarily more expensive than the small package.On this day, Daw...
2019-09-14 21:13:00
101
转载 B. Zmei Gorynich ( Educational Codeforces Round 72 (Rated for Div. 2))
You are fighting with Zmei Gorynich — a ferocious monster from Slavic myths, a huge dragon-like reptile with multiple heads!Initially Zmei Gorynich hasxxheads. You can dealnntypes of bl...
2019-09-14 10:44:00
213
转载 C. Book Reading (Codeforces Round #582 (Div. 3))
Polycarp is reading a book consisting ofnnpages numbered from11tonn. Every time he finishes the page with the number divisible bymm, he writes down the last digit of this page n...
2019-09-13 21:59:00
153
转载 D2 Equalizing by Division (hard version) &&D1 Equalizing by Division (easy version) (easy versio...
The only difference between easy and hard versions is the number of elements in the array.You are given an arrayaaconsisting ofnnintegers. In one move you can choose anyaiaiand divide i...
2019-09-13 09:29:00
187
转载 B. Square Filling ( Educational Codeforces Round 71 (Rated for Div. 2))
You are given two matricesAAandBB. Each matrix contains exactlynnrows andmmcolumns. Each element ofAAis either00or11; each element ofBBis initially00.You may perform so...
2019-09-12 21:11:00
101
转载 A. Creating a Character(Educational Codeforces Round 72 (Rated for Div. 2) )
You play your favourite game yet another time. You chose the character you didn't play before. It hasstrstrpoints of strength andintintpoints of intelligence. Also, at start, the ...
2019-09-10 22:25:00
121
转载 字符画 (CSU 2163 )
读入 w,请输出 2018 的字符画,两个数字之间有 w 个空格。具体格式请参考样例输出。1 ≤ w ≤ 2018Input输入文件只包含 1 个整数 w.Output输出 5 行,每行 12 + 3w 个字符(只包含 o 和 . 两种,字符画的部分用 o,空格的部分用 .),以换行符结尾。Sample Input2Sample Outputo...
2019-09-09 22:18:00
413
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人