
ACM
donCoder
这个作者很懒,什么都没留下…
展开
-
2018蓝桥杯省赛 全球变暖(bfs)
你有一张某海域NxN像素的照片,"."表示海洋、"#"表示陆地,如下所示:........##.....##........##...####....###........其中"上下左右"四个方向上连在一起的一片陆地组成一座岛屿。例如上图就有2座岛屿。 由于全球变暖导致了海面上升,科学家预测未来几十年,岛屿边缘一个像素的范围会被海水淹没。具体来说如果一块陆地像素与海洋相邻(上下左右四个相邻像素中...原创 2018-04-16 15:16:30 · 1630 阅读 · 4 评论 -
HDU 2087 剪花布条(STL、暴力)
Problem Description一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不...原创 2018-06-12 17:46:22 · 253 阅读 · 0 评论 -
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, et...原创 2018-07-23 13:16:23 · 374 阅读 · 0 评论 -
POJ 2796 feel good(单调栈)
题意:求出以a[i]为区间最小数字的区间值(a[i]*区间和)单调栈的性质:1、维护从左往右的递增栈可以得到左边第一个比a[i]小的元素位置L[i]2、维护从左往右的递减栈可以得到左边第一个比a[i]大的元素位置L[i]3、维护从右往左的递增栈可以得到右边第一个比a[i]小的元素位置R[i]4、维护从右往左的递减栈可以得到右边第一个比a[i]大的元素位置R[i]因此,...原创 2018-07-19 19:17:33 · 182 阅读 · 0 评论 -
CodeForces——948C Producing Snow(优先队列)
题目:Alice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of it. Bob has thus bought her a gift — a large snow maker. He plans to make some ...原创 2018-07-20 20:35:43 · 389 阅读 · 0 评论 -
Codeforces——931B World Cup
The last stage of Football World Cup is played using the play-off system.There are n teams left in this stage, they are enumerated from 1 to n. Several rounds are held, in each round the remaining t...原创 2018-07-21 20:36:23 · 224 阅读 · 0 评论 -
vector存图解决最短路(带堆优化)
小明的爸爸突然想抽烟,于是派小明去买烟。现在小明想要寻找最短的从商店到家的路线,你可以帮助他吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示有几个路口,标号为1的路口是商店所在地,标号为N的路口是家所在地,M则表示有几条路。N=M=0表示输入结束。接下来M行,每行包括3个整数A,B,C(1<=A,B<=N,1&l...原创 2018-08-04 16:00:01 · 1475 阅读 · 2 评论 -
Silver Cow Party (Dijkstra)
One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M≤ 100,000) unidirectional (one-way roa...原创 2018-08-01 15:08:54 · 266 阅读 · 0 评论 -
拓扑排序三种方法
#include<stdio.h>#include<string.h>#define N 105int map[N][N],indegree[N];int Topo(int n){ int i,j,ans; for(i=0;i<n;i++) { ans=n; for(j=0;j<n;j++) ...原创 2018-08-01 15:45:52 · 1373 阅读 · 0 评论 -
HDU——1166 敌兵布阵(线段树点更新+区间查询)
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研究敌人究竟演习什么战术,所...转载 2018-08-07 14:20:18 · 157 阅读 · 0 评论 -
棋盘问题
在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n...原创 2018-05-07 17:28:10 · 246 阅读 · 0 评论 -
Codeforces 424 B Megacity【贪心】
The administration of the Tomsk Region firmly believes that it's time to become a megacity (that is, get population of one million). Instead of improving the demographic situation, they decided to ach...原创 2018-05-10 17:37:30 · 234 阅读 · 0 评论 -
Prime Ring Problem
A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime. Note: the number of f...原创 2018-04-11 08:46:10 · 259 阅读 · 0 评论 -
POJ-2456疯牛(二分搜索+最小值最大化)
描述农夫 John 建造了一座很长的畜栏,它包括N (2 <= N <= 100,000)个隔间,这些小隔间依次编号为x1,...,xN (0 <= xi <= 1,000,000,000).但是,John的C (2 <= C <= N)头牛们并不喜欢这种布局,而且几头牛放在一个隔间里,他们就要发生争斗。为了不让牛互相伤害。John决定自己给牛分配隔间,使任意两...原创 2018-04-16 20:28:51 · 484 阅读 · 0 评论 -
Funky Numbers(二分)
As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as , where k is some positive integer), and the coolest numbers are those...原创 2018-04-11 17:43:50 · 472 阅读 · 0 评论 -
HDU 卖水果(map)
夏天来了~~好开心啊,呵呵,好多好多水果~~Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了.Input第一行正整数N(0<N<=10)表示有N组测试数据.每组测试数据的第一行是一个整数M(0<M<=100),表示工有M次成功的交易.其后有M行数据,每行表...原创 2018-04-12 10:56:18 · 216 阅读 · 0 评论 -
(2018蓝桥省赛)递增三元组
标题:递增三元组给定三个整数数组A = [A1, A2, ... AN], B = [B1, B2, ... BN], C = [C1, C2, ... CN],请你统计有多少个三元组(i, j, k) 满足:1. 1 <= i, j, k <= N 2. Ai < Bj < Ck 【输入格式】 第一行包含一个整数N。第二行包含N个整数A1, A2, ... AN。第三...原创 2018-04-12 23:25:30 · 679 阅读 · 0 评论 -
大鱼吃小鱼(栈)
有N条鱼每条鱼的位置及大小均不同,他们沿着X轴游动,有的向左,有的向右。游动的速度是一样的,两条鱼相遇大鱼会吃掉小鱼。从左到右给出每条鱼的大小和游动的方向(0表示向左,1表示向右)。问足够长的时间之后,能剩下多少条鱼?Input第1行:1个数N,表示鱼的数量(1 <= N <= 100000)。 第2 - N + 1行:每行两个数Aii, Bii,中间用空格分隔,分别表示鱼的大小及游动...原创 2018-04-18 19:42:48 · 600 阅读 · 0 评论 -
Subsequence (尺取法)
A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length o...原创 2018-05-10 10:59:01 · 291 阅读 · 0 评论 -
More is better (并查集)
Mr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be. Of course there are certain requirements. Mr Wang selected a room ...原创 2018-05-10 14:53:05 · 183 阅读 · 0 评论 -
PAT甲级 1003 Emergency (Dj最短路)
As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the l...原创 2018-08-16 15:51:35 · 285 阅读 · 2 评论