- 博客(14)
- 收藏
- 关注
原创 Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) B.Problems for Round
B. Problems for Roundtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n problems prepared for the
2016-05-27 18:55:30 359 1
原创 Codeforces Round #352 (Div. 2) C. Recycling Bottles
C. Recycling Bottlestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt was recycling day in Kekoland. To c
2016-05-27 18:44:29 314
原创 Codeforces Round #352 (Div. 2) A.Summer Camp
A. Summer Camptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputEvery year, hundreds of people come to summer
2016-05-27 18:23:12 357
原创 Codeforces Round #353 (Div. 2) C.Money Transfers
C. Money Transferstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n banks in the city where Vasya
2016-05-26 23:54:06 194
原创 Codeforces Round #353 (Div. 2) D. Tree Construction
D. Tree Constructiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDuring the programming classes Vasya w
2016-05-26 15:21:00 259
原创 Codeforces Round #353 (Div. 2) B.Restoring Painting
题意:一个这样的格子,给一个数n,a,b,c,d,向问号格子填1到n的数,让每个正方形的各个格子数字之和相等。问有多少种填法?思路:首先中间格子不会影响到结果,填1-n都是可以的,关键是如何填四角,但是四个角只要确定了一个,其他也是确定的,我们多写几个样例可以知道,初始值最大的格子组合(ab,ac,cd,bd),可填数有最大值,初始值最小的格子组合,可填数有最小值,由于最小组合的要补足最大
2016-05-26 08:58:16 175
原创 Codeforces Round #353 (Div. 2) A. Infinite Sequence
题意:首项为a,公差为b的等差数列,看c是否在该等差数列里面。思路:特判公差是否为0,逆向思维,把a,c与b取模,判断是否相等,判断单调性,注意取模的方法,这个很重要,保证得到的都是相等(同正负)的整数,不然会出现正负不同。 int d=a%c; d=(d+c)%c;#include #include using namespace std;int
2016-05-26 08:45:30 182
原创 Codeforces Round #354 (Div. 2) C .Vasya and String
http://codeforces.com/contest/676/problem/C题意:给你一个长度为n的只有a和b的序列,要你通过小于等于k次变化,让一个具有相同字母的子序列长度最长。思路:一个贪心的思想,要使得子序列最长,必定是a的连续变化或者是b的连续变化。我们向前移动进行变化,当变化次数大于k时,把前面的数变回原样 记录连续最大值即可。#include #in
2016-05-26 08:37:56 180
原创 Codeforces Round #354 (Div. 2) B
Codeforces Round #354 (Div. 2) BB. Pyramid of Glasses题意:把n层杯子排成金字塔形,第n层有n个杯子,每秒加一杯水,问t秒后多少杯子水满了。思路:这里有一个整体与部分的思维,我们把一杯一杯的水看做是整体的t杯水同时倒在1号杯子上(假设不洒),然后比一多的,就分流到下面的杯子上,下面的每个杯子可以获得它左上和右上的1/2(注意边界处理)
2016-05-26 08:29:11 183
原创 Codeforces Round #354 (Div. 2) A
Codeforces Round #354 (Div. 2) Ahttp://codeforces.com/contest/676/problem/A题意:有一个大小为1到n的n个数的序列,通过一次交换,把1和n位置尽量变远。思路:这里我们可以把1和n看做是同等地位的,只需要看1和n那个离边界比较近,就把它移动到边界即可。#include #include #inc
2016-05-26 08:16:43 147
原创 HDU 2579 Dating with girls(2)
这道题目关键在于如何描述状态,首先我们如果只用Y的坐标和时间去描述状态行不行呢? 答案是不行的,因为障碍物的出现与时间有关,搜索是走过了的点标记然后就不再走了假设我们到达点(2,2)用了3秒时间,K=5,(2,3)有障碍物并且通过障碍物我们能更快地到达目的地,但是题目要求是不能在原地停留的,如果我们通过多绕路到达(2,2)用了9秒,那么,我们就可以通过(2,3)的障碍物了。因此,只要t
2015-09-24 15:08:39 281
原创 hdu 1728 逃离迷宫 经典BFS
这道题主要就是如何处理转弯的次数问题,我们可以这样做,把初始转弯次数初始化为-1,然后每次进行四个方向的搜索的时候,转弯次数加一,并且在这一转弯次数之下往4个方向笔直地走(因为直走的话转弯次数不变),把走过的路标记一下,这样,我们就可以确保走到哪个地方,都是使用了最少的转弯次数。这道题的状态表示很简单,就是坐标和转弯次数typedef struct node{ int x,y; int d
2015-09-24 08:05:57 221
原创 HDU 1242 BFS入门经典题
首先总结一下广度优先搜索题目做题的几个主要掌握的1.如何表示状态的变化,图中哪些是动的,哪些是不动的,用结构体去把状态简单的表示出来typedef struct node{ int x,y; int dis; bool operator<(const node &e)const { return dis>e.dis; }};这是这道题的状态表示,因为只有r是动的,用x,y表
2015-09-23 17:04:34 266
原创 HDU 2531
本题因为是求走的步数最少,是求最优解,所以用BFS,关键是如何记录状态,因为棋盘上只有D是能动的,所以用typedef struct node{ int x[24],y[24]; int dis;};去记录棋盘的状态,可用队列去解,详情看代码#include#include#includeusing namespace std;#include #define maxn 1000
2015-09-23 16:26:02 247
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人