自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(26)
  • 收藏
  • 关注

原创 sguAC50,写一下前面的有价值的题目汇总

RT101.欧拉回路及欧拉路径103.最短路的变形106.扩展欧几里得108.筛法+滚动数组优化109.染色110.空间计算几何111.高精度压位or高精度+数学优化119.数学题120.平面计算几何121.图论染色122.具有ore性质的哈密尔顿回路125.构造法126.数学题128.线段树129.计算几何130.卡特兰数131

2014-11-30 13:41:47 418

原创 sgu149:Computer Network

题意:给出一颗N个点的树,并分别给出其(N-1)条边的长度。要求每一个点到它树上的最远点的距离。分析:对于树中的每一个点,它到的最远点要么是它的子树的叶子节点,要么是祖先的异于该结点的儿子的子树上。好像有点绕,其实也就是“往下走”与“往上再往下走”两种情况。遍历一棵树,我们统计该结点子树上与其距离最远的结点所在儿子子树编号num[]及其距离maxl[],以及次远的距离_maxl

2014-11-30 11:54:24 910

原创 sgu148:B-Station(dp+堆优化)

题意:大致就是求最小费用的方案使得最后一层减压。分析:分析一下题意,假如我们从第i层开始减压,其下的所有层均需要减压(不管人工还是自动),否则这种减压就是浪费的。因此我们可以枚举开始减压的层数。然而我们的目的是尽量使更多的层自动减压,并且已经自动减压的层不能再自动减压。由此得第i层自动减压的条件:假设此时开始减压为第j层,pre[]数组为水量的前缀和,那么有pre[j]-pre

2014-11-30 10:53:45 817

原创 sgu147:Black-white king

这道题的解法就看想不想得到...假设white与black横向距离大于纵向距离(否则交换),那么如果white与black要相遇,每次移动有八个方向,则最小步数和x=abs(black.x-white.x)-1;很明显,每一步在y轴上至多扩展2个单位,即top+1,bottom-1,因此从white和black两边会夹出一个区间,这个区间就是white到black的最短路程上可能经过的点。

2014-11-29 00:51:41 711

原创 sgu146:The Runner

根据题目就是在第k段时间里前进Vk*Tk的距离,求最终离start点的最短环上距离。水额,因为输入输出保留四位小数,把l*(1e4),四舍五入,再把读入的Vk*(1e4),然后取模啊,然后取个距离最小值输出。#include using namespace std;int main(){ float l = 0; long long N = 0, L = 0, d = 0; s

2014-11-29 00:49:37 455

原创 sgu145:Strange People

题意很简单,就是要求第k短路。看网上好多人都是用dfs+二分过的,我果断作死写了个dijstra+A*。但最坑的是这道题竟然标程都PE,估计sgu数据坑...代码正确性应该还是有的,还是贴贴吧。#include #include #include using namespace std;const int MAXN = 105, INF = 1e9;int n = 0, m

2014-11-27 23:33:48 548

原创 sgu129:Inheritance

题目大意就是给出一个凸多边形,再给出一些线段,求出每条线段在多边形内部的长度。首先把给出的点按极角排序,求出这个凸多边形。关键是怎样判断一条线段是否与多边形相交,交点,以及内部的长度。判断一条线段是否与多边形相交,即判断其与多边形每条边是否有交点。引理:若线段AB与线段CD相交,那么A、B分别在CD两侧,C、D分别在AB两侧,反之成立。判断两个点分别在线段两侧,我们可以用叉积,

2014-11-26 18:48:02 962 2

原创 sgu144:Meeting

题目: 两支地区ACM比赛的队伍决定为了国际决赛而在一起集训. 他们约定在某天的 X 时到 Y 时的某一时刻相会. 但由于他们很少按时到 (有的队伍比赛那天都会迟到), 他们没有设定一个确切的相遇时间. 然而, 它们约定先到的队伍要等待 Z 分钟(经过计算,他们认为如果过了这么久还没等到那么极有可能另一支队不会来了). 假如两支队都会在X 到Y 点的某一时刻出现 (不

2014-11-25 13:34:47 450

原创 sgu143:Long Live the Queen

题意: 有n(n<=16000)个小镇,每两个小镇有且仅有一条路径相连。每个小镇有一个收益x(-1000<=x<=1000). 现在要求,选择一些小镇,满足下面两点要求: 1.选择的小镇都能互相到达,并且路径上的小镇也被选择了. 2.选择的小镇的收益和最大.输入 一个整数n,接下来n个整数,代表这n个小镇的收益. 接下来n-1行,每行两个整

2014-11-25 12:45:27 497 1

原创 sgu142:Keyword

142. Keywordtime limit per test: 0.5 sec. memory limit per test: 16384 KBKevin has invented a new algorithm to crypt and decrypt messages, which he thinks is unbeatable. The algorithm uses a

2014-11-24 18:34:36 486

原创 sgu141:Jumping Joe

141. Jumping Joetime limit per test: 0.25 sec. memory limit per test: 4096 KBJoe is a frog who likes to jump a lot. In fact, that's all he does: he jumps forwards and backwards on the intege

2014-11-24 00:26:26 471

原创 sgu184:Patties

184. Pattiestime limit per test: 0.25 sec.memory limit per test: 4096 KBinput: standard inputoutput: standard outputPetya is well-known with his famous cabbage patties. Petya's

2014-11-22 14:07:43 488

原创 sgu110:Dungeon

110. Dungeontime limit per test: 0.25 sec. memory limit per test: 4096 KBThe mission of space explorers found on planet M the vast dungeon. One of the dungeon halls is fill with the bright s

2014-11-22 13:46:11 504

原创 sgu140:Integer Sequences

140. Integer Sequencestime limit per test: 0.25 sec. memory limit per test: 4096 KBA sequence A is called an integer sequence of length N if all its elements A1 A2 .. AN are non-negative int

2014-11-21 23:28:50 731 2

原创 sgu139:Help Needed!

139. Help Needed!time limit per test: 0.25 sec. memory limit per test: 4096 KBLittle Johnny likes puzzles a lot! Just a few days ago, he found out about the 'traditional' 4x4 puzzle. For thi

2014-11-20 23:32:45 539

原创 sgu138:Games of Chess

138. Games of Chesstime limit per test: 0.25 sec. memory limit per test: 4096 KBN friends gathered in order to play chess, according to the following rules. In the first game, two of the N f

2014-11-19 18:59:09 539

原创 sgu137:Funny Strings

137. Funny Stringstime limit per test: 0.25 sec. memory limit per test: 4096 KBLet's consider a string of non-negative integers, containing N elements. Suppose these elements are S1 S2 .. SN

2014-11-18 23:35:13 694

原创 sgu180:Inversions

180. Inversionstime limit per test: 0.25 sec.memory limit per test: 4096 KBinput: standardoutput: standardThere are N integers (1A[j].InputThe first line of the input

2014-11-17 21:52:03 414

原创 sgu136:Erasing Edges

136. Erasing Edgestime limit per test: 0.25 sec. memory limit per test: 4096 KBLittle Johnny painted on a sheet of paper a polygon with N vertices. Then, for every edge of the polygon, he dr

2014-11-17 20:38:20 407

原创 sgu135:Drawing Lines

135. Drawing Linestime limit per test: 0.25 sec. memory limit per test: 4096 KBLittle Johnny likes to draw a lot. A few days ago he painted lots of straight lines on his sheet of paper. Then

2014-11-17 19:51:48 460

原创 sgu134:Centroid

134. Centroidtime limit per test: 0.25 sec. memory limit per test: 4096 KBYou are given an undirected connected graph, with N vertices and N-1 edges (a tree). You must find the centroid(s) o

2014-11-17 19:32:58 454

原创 sgu133:Border

133. Bordertime limit per test: 0.25 sec. memory limit per test: 4096 KBAlong the border between states A and B there are N defence outposts. For every outpost k, the interval [Ak,Bk] which

2014-11-17 13:47:01 448

原创 sgu132:Another Chocolate Maniac

132. Another Chocolate Maniactime limit per test: 0.25 sec. memory limit per test: 4096 KBBob really LOVES chocolate. He thinks he never gets enough. Imagine his joy when his parents

2014-11-16 23:36:18 610

原创 sgu131:Hardwood floor

131. Hardwood floortime limit per test: 0.25 sec. memory limit per test: 4096 KBThe banquet hall of Computer Scientists' Palace has a rectangular form of the size M x N (11) rectangles (2x

2014-11-16 17:01:33 417

原创 sgu130:Circle

130. Circletime limit per test: 0.25 sec. memory limit per test: 4096 KBOn a circle border there are 2k different points A1, A2, ..., A2k, located contiguously. These points connect k chords

2014-11-15 21:46:53 389

原创 noip总结

noip结束了, 考试的时候感觉还是有些犯2的,不过1=

2014-11-15 16:14:20 496

空空如也

空空如也

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

TA关注的人

提示
确定要删除当前文章?
取消 删除