- 博客(40)
- 收藏
- 关注
原创 A-Plague Inc
A-Plague Inc 题意:n*m个城市,给你初始几个感染病毒的城市坐标,每天这个城市都可以感染上下左右4个相临城市,问最后被感染的城市坐标,如果有多个,取x坐标小的,如果x坐标一样大,取y坐标小的。题解:我是用的队列,可能做得麻烦了,先根据队列中的元素求出下一天感染的城市坐标,每次将新感染的城市入队,同时前一天感染的城市出队(注意要出干净,我就是干开始没出干净wa了几发)#...
2018-07-24 22:02:15
206
原创 B-Rolling The Polygon
Rolling The Polygon题意:一个多边形滚动,一个点q在多边形的内部或者边上,以每个点为圆心滚动,问滚动一周后,q点经过的路径。计算几何(注意精度的控制)#include<bits/stdc++.h>using namespace std;const double PI= acos(-1);const int maxn =50+5;struct p...
2018-07-18 16:17:17
484
转载 F-Moving On
Moving On题意:两个人住在城市u,每天要去城市v,但是要经过一些城市和街道,而且每个城市都有抢劫等的概率,要求找一条路的从城市u到城市v而且抢劫率不超过w的最短路径。#include<bits/stdc++.h>#define EPS 1e-9using namespace std;typedef long long ll;const int INF=0x3...
2018-07-18 16:06:10
695
原创 A-Maximum Element In A Stack
Maximum Element In A Stack题目大意:对一个栈进行操作入栈和出栈。每次操作后返回当前栈中的最大值,push和pop操作由题目给定的代码段进行决定,最后输出 i为第i次操作,ai为每一次操作的结果即最大值,输出每次的异或和。#include<bits/stdc++.h>using namespace std;typedef long long...
2018-07-17 18:32:56
975
原创 J-Word Search
Word Search题意:单词搜索,在一个单词网中搜索单词,该单词可能存在这个网的水平,垂直,或对角线方向。 no solution:有词汇未在方阵图中出现; ambiguous:词汇在方阵图中出现了两次; empty solution:所有词汇均出现且仅出现一次,最终方阵图无未标记字母; 此外则依次输出剩余大写字母。// Solution...
2018-07-16 11:31:29
155
转载 E-Pawns
Pawns题意:象棋游戏,每一列都有一个黑棋子和一个白棋子,黑棋子始终在白棋子的上方,黑棋子智能网下放移动,白棋子只能往上方移动,一般情况下棋子只能移动一格,特别的当黑白棋子在棋盘两端时,在端点的棋子要移动两格。、棋子只能在所在列移动而且,而且棋子不会少。#include<bits/stdc++.h>using namespace std;const int maxn = 20+5...
2018-07-15 15:01:59
151
翻译 D-Lift Problems
Lift Problems题目大意:每个学生乘坐电梯如果不在自己想要停的楼层停下就会产生怒气值,在低于自己楼层停下,在停下的楼层就会产生一个怒气值,如果超过自己的楼层在上升的楼层,每一层都会产生一个怒气值,比如,想在5层楼停,电梯却在8楼停那么6,7两层都会产生怒气值,然后在8楼下电梯走到5楼。状态转移方程:A(i)=minj<i A(j)+Pi−1 k=j(i−k)∗sk +Pn k=i ...
2018-07-15 08:35:28
174
转载 Failing Components
As a jury member of the Best Architectural Planning Contest, you are tasked with scoring the reliability of a system. All systems entered in the contest consist of a number of components which depend ...
2018-07-14 09:51:31
264
原创 Hangover
DescriptionHow far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must be perpendicular t...
2018-07-09 12:46:17
333
原创 Choosing Ice Cream
You are standing in the supermarket in front of the freezers. You have a very tough task ahead of you: you have to choose what type of ice cream you want for after dinner that ...
2018-07-08 20:43:05
246
转载 计蒜客-不合格米线
题目不会做!,转发大牛的某天江南米线公司发生了一件倒霉的事情:公司不小心把不合格米线发出去给零售商了。很不幸,你发现这件事的时候,这部分米线已经在运算路上。这个零售物流网络很大,而且关系复杂。你知道这米线要发给哪个零售商,但是要把这批米线送到他手中有许多种途径。物流网由一些仓库和运输卡车组成,每辆卡车都在各自固定的两个仓库之间单向运输米线。在追查这些有不合格米线的时候,必须保证它不被送到零售商手里...
2018-05-01 16:18:50
189
原创 UVA-201 Squares
A children’s board game consists of a square array of dots that contains lines connecting some of thepairs of adjacent dots. One part of the game requires that the players count the number of squares ...
2018-04-21 11:03:37
221
转载 1018—Communication System
Communication SystemTime Limit: 1000MS Memory Limit: 10000KTotal Submissions:30175 Accepted: 10737DescriptionWe have received an order from Pizoor Communications Inc. for a special communication syste...
2018-03-18 11:21:42
181
原创 2664 Prerequisites?
Prerequisites?Time Limit: 2000MS Memory Limit: 65536KTotal Submissions:4002 Accepted: 2510DescriptionFreddie the frosh has chosen to take k courses. To meet the degree requirements, he must take cours...
2018-03-14 19:42:36
206
原创 2339Rock, Scissors, Paper
DescriptionBart's sister Lisa has created a new civilization on a two-dimensional grid. At the outset each grid location may be occupied by one of three life forms: Rocks, Scissors, or Papers. Each da...
2018-03-13 19:56:33
186
翻译 2612Mine Sweeper
Mine SweeperTime Limit: 1000MS Memory Limit: 65536KTotal Submissions:7034 Accepted: 2718DescriptionThe game Minesweeper is played on an n by n grid. In this grid are hidden m mines, each at a distinct...
2018-03-11 17:25:48
258
原创 poj 1528
PerfectionTime Limit: 1000MS Memory Limit: 10000KTotal Submissions:13198 Accepted: 6044DescriptionFrom the article Number Theory in the 1994 Microsoft Encarta: ``If a, b, c are integers such that a = ...
2018-03-10 11:02:57
203
原创 POJ 2234
Matches Game DescriptionHere is a simple game. In this game, there are several piles of matches and two players. The two player play in turn. In each turn, one can choose a pile and take away arbitr...
2018-03-10 10:22:56
283
原创 HDU1.31-Design T-Shirt
Soon after he decided to design a T-shirt for our Algorithm Board on Free-City BBS, XKA found that he was trapped by all kinds of suggestions from everyone on the board. It is indeed a mission-impossi
2018-01-18 10:06:36
178
转载 Least Common Multiple
The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105.InputI
2017-11-12 21:20:17
91
转载 1708-FatMouse and Cheese
FatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid location is labelled (p,q) where 0 <= p < n and 0 <= q < n. At each grid location Fatmo
2017-11-09 20:49:28
201
原创 2017年11月09日_用户6071057617_新浪博客
FatMouse has storedsome cheese in a city. The city can be considered as a square gridof dimension n: each grid location is labelled (p,q) where 0 <=p < n and 0 <= q < n. At each gri...
2017-11-09 20:46:04
69
原创 1708-FatMouse and Cheese_用户6071057617_新浪博客
FatMouse has stored some cheese in acity. The city can be considered as a square grid of dimension n:each grid location is labelled (p,q) where 0 <= p < n and 0<= q < n. At each gri...
2017-11-09 20:43:32
74
转载 1730-Northcott Game
Tom和Jerry正在玩一种Northcott游戏,可是Tom老是输,因此他怀疑这个游戏是不是有某种必胜策略,郁闷的Tom现在向你求救了,你能帮帮他么?游戏规则是这样的: 如图所示,游戏在一个n行m列(1 ≤ n ≤ 1000且2 ≤ m ≤ 100)的棋盘上进行,每行有一个黑子(黑方)和一个白子(白方)。执黑的一方先行,每次玩家可以移动己方的任何一枚棋子到同一行的任何一个空格上,当然这
2017-10-30 20:26:25
158
原创 2017年10月29日_用户6071057617_新浪博客
We all love recursion! Don't we?Consider a three-parameter recursive function w(a, b,c):if a <= 0 or b <= 0 or c <= 0, then w(a, b, c)returns: 1if a > 20 or b > 20 or c &g...
2017-10-29 15:38:02
104
原创 1239-贪心算法_用户6071057617_新浪博客
Problem DescriptionA message from humans to extraterrestrial intelligence wassent through the Arecibo radio telescope in Puerto Rico on theafternoon of Saturday November 16, 1974. The message c...
2017-10-28 20:26:45
155
原创 1203-I NEED A OFFER!_用户6071057617_新浪博客
Problem DescriptionSpeakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了。要申请国外的任何大学,你都要交纳一定的申请费用,这可是很惊人的。Speakless没有多少钱,总共只攒了n万美元。他将在m个学校中选择若干的(当然要在他的经济承受范围内)。每个学校都有不同的申请费用a(万美元),并且Speakless估...
2017-10-27 19:28:18
75
原创 HDU-1729_用户6071057617_新浪博客
This game is a two-player game and isplayed as follows:1. There are n boxes; each box has its size. The box can hold up tos stones if the size is s.2. At the beginning of the game, there are ...
2017-10-26 21:04:15
143
原创 二分查找-平方根_用户6071057617_新浪博客
设计函数int sqrt(int x),计算 xx 的平方根。输入格式输入一个 整数 xx,输出它的平方根。直到碰到文件结束符(EOF)为止。输出格式对于每组输入,输出一行一个整数,表示输入整数的平方根。样例输入123456789样例输出111222223实现代码#include#includeusing namesp...
2017-10-24 17:28:24
118
原创 动态规划-等和的分隔子集_用户6071057617_新浪博客
晓萌希望将1到N的连续整数组成的集合划分成两个子集合,且保证每个集合的数字和是相等。例如,对于N=3,对应的集合{1,2,3}能被划分成{3}和 {1,2}两个子集合.这两个子集合中元素分别的和是相等的。对于N=3,我们只有一种划分方法,而对于N=7时,我们将有4种划分的方案。输入包括一行,仅一个整数,表示N的值(1≤N≤39)。输出包括一行,仅一个整数,晓萌可以划分对...
2017-10-22 16:06:03
139
原创 跳跃游戏-贪心_用户6071057617_新浪博客
给定一个非负整数数组,假定你的初始位置为数组第一个下标。数组中的每个元素代表你在那个位置能够跳跃的最大长度。请确认你是否能够跳跃到数组的最后一个下标。例如:A = [2,3,1,1,4]A=[2,3,1,1,4] 能够跳跃到最后一个下标,输出true;A = [3,2,1,0,4]不能跳跃到最后一个下标,输出false。输入格式第一行输入一个正整数n(1≤n≤50...
2017-10-21 14:02:27
93
原创 跳跃游戏2_用户6071057617_新浪博客
给定一个非负整数数组,假定你的初始位置为数组第一个下标。数组中的每个元素代表你在那个位置能够跳跃的最大长度。你的目标是到达最后一个下标,并且使用最少的跳跃次数。例如:A =[2,3,1,1,4],到达最后一个下标的最少跳跃次数为 2。(先跳跃 1步,从下标 0 到 1,然后跳跃 3步,到达最后一个下标。一共两次)输入格式第一行输入一个正整数...
2017-10-20 20:11:48
146
原创 爬楼梯_用户6071057617_新浪博客
假设你现在正在爬楼梯,楼梯有 nn 级。每次你只能爬 1 级或者 2 级,那么你有多少种方法爬到楼梯的顶部?输入格式第一行输入一个整数 n(1≤n≤50),代表楼梯的级数。输出格式输出爬到楼梯顶部的方法总数。样例输入5样例输出8简单的动态规划最后一次可以为一步也可以为两步,即n阶楼梯的问题转换为,n-1阶楼梯和n-2阶楼梯和的问题。#includeu...
2017-10-19 19:14:40
100
原创 组合博弈1536-S-Nim_用户6071057617_新浪博客
Arthur and his sister Caroll have beenplaying a game called Nim for some time now. Nim is played asfollows:The starting position has anumber of heaps, all containing some, not necessarily...
2017-10-18 09:27:32
156
原创 1404-Digital Deletions_用户6071057617_新浪博客
Digital deletions is a two-player game.The rule of the game is as following.Begin by writing down a string of digits (numbers) that's as longor as short as you like. The digits can be 0, 1, 2,...
2017-10-17 14:43:54
123
原创 1010-Tempter of the Bone_用户6071057617_新浪博客
The doggie found a bone in an ancientmaze, which fascinated him a lot. However, when he picked it up,the maze began to shake, and the doggie could feel the groundsinking. He realized that the b...
2017-10-15 13:09:49
123
原创 1005—I Think I Need a Houseboat_用户6071057617_新浪博客
I Think I Need a HouseboatTime Limit:1000MSMemory Limit:10000KTotal Submissions:105572Accepted:45982DescriptionFred Mapper isconsidering purchasing some land in Louisiana t...
2017-10-07 10:37:04
419
原创 欢迎您在新浪博客安家_用户6071057617_新浪博客
亲爱的朋友:欢迎您在新浪博客安家,您的博客地址是:http://blog.sina.com.cn/u/6071057617您可以用文字、图片、视频记录和展示最真实的自我,与网友交流,与线上好友聊天,还能通过手机发表博文和上传图片,随时随地记录心情和身边趣闻。我们为您提供了丰富的炫酷模板来装点您在网上的家园,强大的音乐播放功能更能陪伴您的网络生活。准备好了吗?现在就开...
2017-10-01 18:55:33
91
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人