自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 UVa OJ 1220 - Party at Hali-Bula

UVa OJ 1220 - Party at Hali-BulaProblemHere is the: problem linkSolution这道题目一开始没有用f[][]来标记是否重复,导致WA了一次,后来就加上去了。另外,在处理人名时,虽然实例输入里,上司和下属名字出现是有先后的,但是提交之后,系统的测试数据貌似不一定是这样,所以要先判断是否出现,没出现就用cnt加1再赋值递归的思路还是不难的

2016-09-30 23:03:29 354

原创 UVa OJ 12186 - Another Crisis

UVa OJ 12186 - Another CrisisProblemA couple of years ago, a new world wide crisis started, leaving many people with economical problems. Some workers of a particular company are trying to ask for an

2016-09-29 21:57:29 279

原创 UVa OJ 1331 - Minimax Triangulation

UVa OJ 1331 - Minimax TriangulationProblemHere is the: problem linkSolution这道题目一开始用递归做,但是时间比较长,于是花了比较长的时间去想应该怎么才能转化成递推这道题目用d[i][j]来表示从i点切割到j点中所含的面积最大的三角形中,最小的那个这里用了三个循环,第一层是确定分割时跨越的点数,第二层是起点,第三层就是起点和终点

2016-09-29 16:45:29 391

原创 UVa OJ 10003 - Cutting Sticks

UVa OJ 10003 - Cutting SticksProblemYou have to cut a wood stick into pieces. The most affordable company, The Analog Cutting Machinery, Inc. (ACM), charges money according to the length of the stick b

2016-09-27 12:58:53 381

原创 UVa OJ 1625 - Color Length

UVa OJ 1625 - Color LengthProblemHere is the prolem linkSolution这道题目要先处理好每个颜色的起止位置,不然会很不方便。用数组d[i][j]表示已经插入了第一个字符串的i个,第二个字符串的j个字母。递推的时候,只要发现还有字母没有用完,就加1#include <iostream>#include <cstdio>#include <c

2016-09-27 09:16:08 340

原创 UVa OJ 11584 - Partitioning by Palindromes

UVa OJ 11584 - Partitioning by PalindromesProblemHere is the: linkSolution先对字符串进行预处理,把回文字符串的长度全部记录下来,然后用DP对回文字符串的个数进行处理。最小个数=min(之前已经处理过的长度所含回文字符串的最小值+未处理的长度所含回文字符数的最小值)#include <iostream>#include <cs

2016-09-25 13:51:57 282

原创 UVa OJ 11400 - Lighting System Design

UVa OJ 11400 - Lighting System DesignProblemYou are given the task to design a lighting system for a huge conference hall. After doing a lot of calculation and sketching, you have figured out the requi

2016-09-25 11:18:19 294

原创 UVa OJ 12563 - Jin Ge Jin Qu hao

UVa 12563 - Jin Ge Jin Qu haoProblemHere is the: linkSolution这道题目一开始用时间作为一个大循环去进行递推,但是发现并不是很好判断歌曲是否有唱过,所以后来还是采用歌曲作为大循环,再以时间为小循环。不过记得要留出出1s来给《劲歌金曲》#include <iostream>#include <cstdio>#include <cstring

2016-09-24 22:11:07 274

原创 UVa OJ 116 - Unidirectional TSP

UVa OJ 116 - Unidirectional TSPProblemHere is the: problem linkSolutions这道题目不难,但是要注意一下输出的格式,我因为输出格式的问题反复提交了好几次我们用dp[i][j]来表示(i,j)距离最后一列的距离。为了节省时间,用了一个Next[]数组来保存向右走的路径,避免反复取余造成的时间上的浪费。还有,记得不要用next和end,

2016-09-24 09:41:39 343

原创 std::ios_base::sync_with_stdio()

std::ios_base::sync_with_stdio()今天在做OJ的时候意外地发现printf和cout的输出顺序和代码顺序不一样,如下printf("Case Number %d: ", ++cas);if(takeTime[0][1] >= 0x3f3f3f3f) cout << "impossible\n";else cout << takeTime[0][1] << '\n';

2016-09-23 15:56:33 977

原创 UVa OJ 1347 - Tour

UVa OJ 1347 - TourProblemJohn Doe, a skilled pilot, enjoys traveling. While on vacation, he rents a small plane and starts visiting beautiful places. To save money, John must determine the shortest clo

2016-09-23 15:55:11 485

原创 UVa OJ 437 - The Tower of Babylon

UVa OJ 437 - The Tower of BabylonProblemThe babylonians had n types of blocks, and an unlimited supply of blocks of each type. Each type-i block was a rectangular solid with linear dimensions (xi, yi,

2016-09-22 23:07:00 305

原创 UVa OJ 12265 - Selling Land

UVa OJ 12263 - Selling LandProblem输入一个n*m(1≤n,m≤1000)矩阵,每个格子可能是空地,也可能是沼泽。对于每个空地格子,求出以它为右下角的空矩形的最大周长,然后统计每个周长出现了多少次。InputOn the first line a positive integer: the number of test cases, at most 100. Afte

2016-09-21 21:00:50 322

原创 The Python Challenge Level-11 Solution

The Python Challenge Level-11 Solution先附上我在Github上存放的代码仓库: The Python Challenge这个题目感觉就很玄乎了,就只给我们一张图片,网页源码里空空如也这里实际上是把一张图片拆分成两张来看。我尝试了不同的奇偶拆分方式,最终还是选定了X轴和Y轴相加的方式来判断奇偶from io import BytesIOfrom PIL impo

2016-09-20 23:18:49 295

原创 UVa OJ 1442 - Cav

UVa OJ 1442 - CavProblemLink: 1442 - CavSolutionUse greedy algorithm to deal with this problem.Adjust the height of ceiling to fit the requirements. Here is the code:#include <iostream>#include <cstdi

2016-09-20 20:57:23 307

原创 The Python Challenge Level 9-10 Solutions

The Python Challenge Level 9-10 Solutions先附上我在Github上存放的代码仓库: The Python ChallengeLevel 9第九关树的图片其实是一个提示,就是要我把点一个个的连起来,而这个点是由网页源代码里注释的first和second部分给出的,我直接把两个部分的坐标提取到一起,能够得到一个牛的图片import requestsimport

2016-09-19 20:53:22 403

原创 The Python Challenge Level-8 Solution

The Python Challenge Level-8 Solution先附上我在Github上存放的代码仓库: The Python Challenge这道题目消耗了我相当长的一段时间,让我对str和byte也有了一个新的认识。首先还是老样子,进入网页源代码,看看里面有什么首先引入眼帘的是一大串坐标代码,加上第七题的做法,很容易让人产生误会。我也试着去把他门转换了一下,发现并没有什么用处,然后就

2016-09-18 15:43:35 319

原创 The Python Challenge Level-7 Solution

The Python Challenge Level-7 Solution先附上我在Github上存放的代码仓库: The Python Challenge这道题目网页源代码里没有什么别的提示,而图片中有个条形码类似物,那么就需要我们对图片进行处理了。先想办法把条形码读出来,并且转换成可读的文字#! /usr/bin/env python3# -*- coding: utf-8 -*-from P

2016-09-18 11:04:12 296

原创 The Python Challenge Level-5 Solution

The Python Challenge Level-5 Solution先附上我在Github上存放的代码仓库: The Python Challenge先看提示:pronounce it 再看看网页源码,’peak hell’能代表什么?我一开始以为是’pick’什么东西,点开’banner.p’之后没发现什么规律,于是先google了一下’peak hell’,发现了Python有pickle

2016-09-17 20:48:45 248

原创 The Python Challenge Level-4 Solution

The Python Challenge Level-4 Solution先附上我在Github上存放的代码仓库: The Python Challenge依然是先查看网页源代码。发现有个链接’…nothing=12345’点进去之后发现又给我们一个数字,引导我们去下一个链接,于是可以知道,只要链接爬到了终点,那么就会出现别的提示信息果然,爬到终点之后,提示我们除以二,继续爬,所以只要把代码改个数字

2016-09-17 20:34:04 237

原创 The Python Challenge Level-3 Solution

The Python Challenge Level-3 Solution先附上我在Github上存放的代码仓库: The Python Challenge这里按照题目意思,利用正则匹配,找到恰好分别被三个大写字母包在左右的小写字母就好#! /usr/bin/env python3# -*- coding: utf-8 -*-__author__ = 'Yuuki_Dach'from urlli

2016-09-17 20:25:54 245

原创 The Python Challenge Level-6 Solution

The Python Challenge Level-6 Solution先附上我在Github上存放的代码仓库: The Python Challenge这道题目开始让人很迷茫了(至少我是这样),先点开网页源码,没发现什么有价值等东西,然后又看看图片,发现右上角有个箭头,指着几个数字3,于是照着填进去了,发现没有链接,于是又跑去看源码,终于在开头发现了这个:<!-- <-- zip -->于是将’

2016-09-17 20:16:57 307

原创 The Python Challenge Level-2 Solution

The Python Challenge Level-2 Solution先附上我在Github上存放的代码仓库: The Pyhton ChallengeThe Python Challenge第二关给了我们一张书的图片,但是十分模糊的,什么都看不清,这个时候,我们看看它给我们的文字提示是 MAYBE they are in the page source.这个时候我们点击鼠标右键,查看网页

2016-09-17 13:32:02 317

原创 The Python Challenge Level 0-1 Solutions

The Python Challenge 0-1 Solutions前两天听说了有The Python Chanllenge这么一个游戏,于是自己也想来尝试一下。感觉还是一个挺有意思的。附上我在Github上存放的代码仓库: The Pyhton ChallengeChallenge 0第0关只是一个让你大概清楚怎么玩的一个关卡,只要按照图片上的意思,计算2的38次方即可。这个就无所谓是用Pytho

2016-09-17 13:26:27 495

原创 UVa OJ 1609 - Foul Play

UVa OJ 1609 - Foul PlayProblemn支队伍(2≤n≤1024,且n是2的整数幂)打淘汰赛,每轮都是两两配对,胜者进入下一轮。每支队伍的实力固定,并且已知每两支队伍之间的一场比赛结果。你喜欢1号队。虽然它不一定是最强的,但是它可以直接打败其他队伍中的至少一半,并且对于每支1号队不能直接打败的队伍t,总是存在一支1号队能直接打败的队伍t’使得t’能直接打败t。问:是否存在一种比

2016-09-16 16:08:04 310

原创 Ubuntu下使用Python3

Ubuntu下使用Python3这篇文章算是给初次在Ubuntu上使用Python编程的人一个提醒吧。 使用方法首先我们要知道Ubuntu自带的是Python2,然而有很多人(比如我)在学习Python的时候希望使用Python3 我们先使用sudo apt install python3老版本Ubuntu请将 ‘apt’ 改为 ‘apt-get’安装好了Python3之后,我们想在终端中直接使

2016-09-14 10:41:42 3383

原创 UVa OJ 1608 - Non-boring sequences

UVa OJ 1608 - Non-boring sequencesProblemA sequence is called non-boring if its every connected subsequence contains a unique element, i.e. an element such that no other element of that subsequence has

2016-09-10 17:52:59 418

原创 Ubuntu以太网已断开的解决办法

Ubuntu以太网无法连接的解决办法有部分人在使用Ubuntu的时候可能会遇到和我一样的问题,就是以太网显示已断开,这面原因有很多,但是大多都是驱动问题。网上也有教程,亲测以后发现有些地方并不适用,这里我们就来谈谈这个问题。我的Ubuntu版本是16.04 LTS, 有线网卡是Realtek的 装完系统以后以太网显示已断开,但是如果编辑连接的话,可以发现,其实是一直在使用的。真正原因,是网卡驱动不

2016-09-10 14:32:47 14585 3

原创 UVa OJ 12174 - Shuffle

ProblemYou are listening to your music collection using the shuffle function to keep the music surprising. You assume that the shuffle algorithm of your music player makes a random permutation of the s

2016-09-06 22:59:32 313

原创 UVa OJ 1607 - Gates

UVa OJ 1607 - GatesProblem描述起来很麻烦,大家还是直接去OJ站看吧。我之后也会解释一下题目的意思 题目链接: 1607 - GatesInputThe first line of the input contains exactly one positive integer d equal to the number of data sets, 1 ≤ d ≤ 20. T

2016-09-06 11:04:40 506

原创 UVa OJ 11093 - Just Finish it up

UVa OJ 11093 - Just Finish it upProblemAlong a circular track, there are N gas stations, which are numbered clockwise from 1 up to N. At station i, there are pi gallons of petrol available. To race fro

2016-09-05 19:55:15 364

原创 C++函数对象,Lambda,function,bind相关知识

C++函数对象,Lambda,function,bind相关知识昨天做题时无意间得知了<functional>这个头文件,之后自己也稍微地了解了一下相关的一些知识。 内容比较多,叙述方面可能不是很详尽,大家如果看完还有不是很理解的地方,建议进文末的链接看看。<functional>头文件关于这个头文件,在cppreference.com中是这样定义的: This header is part

2016-09-04 22:36:21 409

原创 UVa OJ 12627 - Erratic Expansion

UVa OJ 12627 - Erratic ExpansionProblem这个问题要带图才能方便理解题意,这里为了节省时间,大家自己去网站看题目就好。我真是太懒了 :p InputThe first line of input is an integer T (T < 1000) that indicates the number of test cases. Each case contai

2016-09-04 18:16:20 427

原创 UVa OJ 10954 - Add All

UVa OJ 10954 - Add AllProblem有n(n≤5000)个数的集合S,每次可以从S中删除两个数,然后把它们的和放回集合, 直到剩下一个数。每次操作的开销等于删除的两个数之和,求最小总开销。所有数均小于 105。 InputEach test case will start with a positive number, N (2 ≤ N ≤ 5000) followed by

2016-09-03 22:38:22 282

原创 UVa OJ 714 - Copying Books

UVa OJ 714 - Copying BooksProblem把一个包含m个正整数的序列划分成k个(1≤k≤m≤500)非空的连续子序列,使得每个正 整数恰好属于一个序列。设第i个序列的各数之和为S(i),你的任务是让所有S(i)的最大值尽 量小。例如,序列1 2 3 2 5 4划分成3个序列的最优方案为1 2 3 | 2 5 | 4,其中S(1)、S(2)、S(3) 分别为6、7、4,最大值为

2016-09-01 20:59:41 403

空空如也

空空如也

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

TA关注的人

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