
思维
真的是沐白
前端开发
展开
-
64. Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizesthe sum of all numbers along its path.Note: You can only move either down or right at an...原创 2019-02-20 18:11:41 · 121 阅读 · 0 评论 -
A-长方体
链接:https://www.nowcoder.com/acm/contest/109/A来源:牛客网长方体时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld题目描述给出共享长方体一个顶点的三个面的面积,求它十二条边的边长和。输入描述:一行三个整数a, b, c表示面积(1 <= a, b, c <...原创 2018-05-05 22:43:44 · 1548 阅读 · 0 评论 -
H - Lazier Salesgirl
Kochiya Sanae is a lazy girl who makes and sells bread. She is an expert at bread making and selling. She can sell the i-th customer a piece of bread for price pi. But she is so lazy that she will fal...原创 2018-04-27 08:48:37 · 288 阅读 · 0 评论 -
B - Unrequited Love ZOJ - 3601
Unrequited Love ZOJ - 3601 这是一道模拟题,思路很重要,直接按照题意写的话,可能会很麻烦,出错了很难差bug , 我们可以明确的是一个paty顶多只有一个人是queen或者是King,那么我们首先把参加paty的人先遍历一遍,找到最可能为 King或者是queen的人,然后只需要一次遍历就可以判断是否存在以及如果存在他又是谁#include<bi...原创 2018-04-26 23:27:56 · 197 阅读 · 0 评论 -
K - Mahjong Sorting
DreamGrid has just found a set of Mahjong with suited tiles and a White Dragon tile in his pocket. Each suited tile has a suit (Character, Bamboo or Dot) and a rank (ranging from 1 to ), and there is...原创 2018-05-04 19:07:03 · 343 阅读 · 0 评论 -
C - Defuse the Bomb
The bomb is about to explode! Please defuse it as soon as possible!There is a display showing a number from 1 to 4 on the bomb. Besides this, there are 4 buttons under the display. Each button is labe...原创 2018-04-26 19:47:56 · 272 阅读 · 0 评论 -
D - Draw Something Cheat
Have you played Draw Something? It's currently one of the hottest social drawing games on Apple iOS and Android Devices! In this game, you and your friend play in turn. You need to pick a word and dra...原创 2018-04-26 19:43:06 · 169 阅读 · 0 评论 -
C - Function
The shorter, the simpler. With this problem, you should be convinced of this truth. You are given an array AA of NN postive integers, and MM queries in the form (l,r)(l,r). A function F(l,r) (1≤l...原创 2018-05-10 23:33:35 · 302 阅读 · 0 评论 -
B - Ball
Jenny likes balls. He has some balls and he wants to arrange them in a row on the table. Each of those balls can be one of three possible colors: red, yellow, or blue. More precisely, Jenny has R red ...原创 2018-05-10 21:00:40 · 259 阅读 · 0 评论 -
F - Now Loading!!!
Now Loading!!!Time Limit: 1 Second Memory Limit: 131072 KBDreamGrid has integers . DreamGrid also has queries, and each time he would like to know the value offor a given number , where , .Inpu...原创 2018-05-02 22:59:50 · 617 阅读 · 0 评论 -
I - People Counting ZOJ - 3944
In a BG (dinner gathering) for ZJU ICPC team, the coaches wanted to count the number of people present at the BG. They did that by having the waitress take a photo for them. Everyone was in the photo ...原创 2018-04-25 08:27:56 · 257 阅读 · 0 评论 -
B. Marlin
B. Marlintime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe city of Fishtopia can be imagined as a grid of 44 rows and an odd number of columns. I...原创 2018-05-09 13:49:47 · 539 阅读 · 3 评论 -
H - number game
小Hi和小Ho在玩一个数字游戏。小Hi给出两个N位整数A和B(可能有前导0),小Ho需要经过最少次数的变换将A变成B。一次变换可以进行以下操作之一:1. 交换任意两位数字。例如 12345 -> 42315。 2. 选择任意一位数字加1或减1。注意0减1会变成9,9加1会变成0。 请你帮助小Ho求出最少的变换次数。Input第一行包含一个整数N,代表位数。 第二行包含两个整数A和B。 ...原创 2018-04-24 20:06:01 · 252 阅读 · 0 评论 -
D. Colorful Points
D. Colorful Pointstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a set of points on a straight line. Each point has a color assigne...原创 2018-05-06 19:00:36 · 237 阅读 · 0 评论 -
ZOJ Problem Set - 2102 Tables
ZOJ Problem Set - 2102TablesTime Limit: 2 Seconds Memory Limit: 65536 KBGranny likes dropping around in the neighborhood. She is rather aged so she always carries a stick to assist walking. When ...原创 2018-05-08 14:44:29 · 200 阅读 · 0 评论 -
65. Valid Number
Validate if a given string can be interpreted as a decimal number.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true" -90e3 "原创 2019-02-19 20:44:48 · 134 阅读 · 0 评论 -
67. Add Binary
Given two binary strings, return their sum (also a binary string).The input strings are both non-empty and contains only characters 1 or 0.Example 1:Input: a = "11", b = "1"Output: "100"Exam...原创 2019-02-19 11:38:48 · 133 阅读 · 0 评论 -
57. Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Examp...原创 2019-02-19 10:59:13 · 147 阅读 · 0 评论 -
997. Find the Town Judge
In a town, there areNpeople labelled from1toN. There is a rumor that one of these people is secretly the town judge.If thetown judge exists, then:The town judge trusts nobody. Everybody (e...原创 2019-02-24 13:32:23 · 328 阅读 · 0 评论 -
32. Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.Example 1:Input: "(()"Output: 2Explanation: The longest valid...原创 2019-02-13 12:50:37 · 218 阅读 · 0 评论 -
59. Spiral Matrix II
这道题和另一道题目54. Spiral Matrix,很相似,我觉得会了那道题,这题是很简单的,下面是那题的博客链接https://blog.youkuaiyun.com/dreamjay1997/article/details/87437861Given a positive integer n, generate a square matrix filled with elements from ...原创 2019-02-18 13:08:29 · 206 阅读 · 0 评论 -
66. Plus One
Given a non-empty array of digits representing a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at the head of the list, and each element...原创 2019-02-17 14:12:59 · 247 阅读 · 0 评论 -
16. 3Sum Closest
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would ...原创 2019-02-11 12:24:32 · 145 阅读 · 0 评论 -
989. Add to Array-Form of Integer
For a non-negative integer X, the array-form of X is an array of its digits in left to right order. For example, if X = 1231, then the array form is [1,2,3,1].Given the array-form A of a non-negati...原创 2019-02-10 23:00:33 · 201 阅读 · 0 评论 -
56. Merge Intervals
Given a collection of intervals, merge all overlapping intervals.Example 1:Input: [[1,3],[2,6],[8,10],[15,18]]Output: [[1,6],[8,10],[15,18]]Explanation: Since intervals [1,3] and [2,6] overlaps...原创 2019-02-16 18:39:37 · 265 阅读 · 0 评论 -
54. Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.Example 1:Input:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]Output: [1,2,3,6,9,8,7,4,5]...原创 2019-02-16 11:45:07 · 149 阅读 · 0 评论 -
String Without AAA or BBB
Given two integers A and B, return any string S such that:S has length A + B and contains exactly A 'a' letters, and exactly B 'b' letters; The substring 'aaa' does not occur in S; The substring '...原创 2019-01-27 13:23:13 · 302 阅读 · 0 评论 -
A - Peak (第十五届浙江省程序设计竞赛)
A sequence of integers is called a peak, if and only if there exists exactly one integer such that , and for all , and for all .Given an integer sequence, please tell us if it's a peak or not.Inp...原创 2018-05-01 23:29:24 · 1801 阅读 · 0 评论 -
E - The shortest problem
In this problem, we should solve an interesting game. At first, we have an integer n, then we begin to make some funny change. We sum up every digit of the n, then insert it to the tail of the number ...原创 2018-04-19 21:43:58 · 144 阅读 · 0 评论 -
2018 ACM-ICPC 中国大学生程序设计竞赛线上赛
512KDescription:1// Q.cpp2#include <iostream>3using namespace std;4const long long M = 1000000007;5const long long MAXL = 1000000;6long long a[MAXL];7long long Q(int n, long long t)8{9 if(n ...原创 2018-04-23 17:10:02 · 2233 阅读 · 0 评论 -
What Kind of Friends Are You?
Japari Park is a large zoo home to extant species, endangered species, extinct species, cryptids and some legendary creatures. Due to a mysterious substance known as Sandstar, all the animals have bec...原创 2018-04-02 23:07:56 · 510 阅读 · 0 评论 -
L2-009. 抢红包
L2-009. 抢红包时间限制300 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越没有人没抢过红包吧…… 这里给出N个人之间互相发红包、抢红包的记录,请你统计一下他们抢红包的收获。输入格式:输入第一行给出一个正整数N(<= 104),即参与发红包和抢红包的总人数,则这些人从1到N编号。随后N行,第i行给出编号为i的人发红包的记录,格式如下:K N1 P...原创 2018-03-27 21:26:27 · 108 阅读 · 0 评论 -
L1-019. 谁先倒
L1-019. 谁先倒时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越划拳是古老中国酒文化的一个有趣的组成部分。酒桌上两人划拳的方法为:每人口中喊出一个数字,同时用手比划出一个数字。如果谁比划出的数字正好等于两人喊出的数字之和,谁就输了,输家罚一杯酒。两人同赢或两人同输则继续下一轮,直到唯一的赢家出现。下面给出甲、乙两人的酒量(最多能喝多少杯不倒...原创 2018-03-27 00:15:15 · 109 阅读 · 0 评论 -
F - 挑选子集
给定N个整数A1, A2, ... AN,小Hi希望从中选出M个整数,使得任意两个选出的整数的差都是K的倍数。 请你计算有多少种不同的选法。由于选法可能非常多,你只需要输出对1000000009取模的结果。Input第一行包含三个整数N、M和K。 第二行包含N个整数A1, A2, ... AN。 对于30%的数据,2 ≤ M ≤ N ≤ 10 对于100%的数据,2 ≤ M ≤ N ≤ 1...原创 2018-04-08 23:12:24 · 268 阅读 · 0 评论 -
2018年团体程序设计天梯赛-模拟赛
L1-8 外星人的一天(15 point(s))地球上的一天是 24 小时。但地球上还有一些精力和勤奋度都远超一般人的大神级人物,他们的“一天”是以 48 小时为周期运转的,这种人被人们尊称为“外星人”。比如普通人的周一早 8:30 是外星人的周一早 4:15;普通人的周二早 9:21 是外星人的周一下午 4:40 —— 对外星人而言,一周的工作时间只有三天(即普通人的周一至周六),周日他们会蒙头...原创 2018-03-25 19:42:12 · 1373 阅读 · 0 评论 -
L - 股票价格II
小Hi最近在关注股票,为了计算股票可能的盈利,他获取了一只股票最近N天的价格A1~AN。在小Hi的策略中,每天可以在下列三种操作中选取一种:1.什么也不做;2.按照当天的价格买进一个单位的股票;3.按照当天的价格卖出部分或所有股票。现在小Hi希望能够知道,如果在N天前手中持有的股票数为0,并且假设拥有无限的金钱,在这N天结束能够获得的最大利润是多少?Input第一行包含一个整数N。 第二行包含N...原创 2018-04-07 21:14:14 · 1262 阅读 · 0 评论 -
提取用户名
在现在的各种互联网应用中,在一段文字中使用'@'字符来提起一名用户是流行的做法。 例如:"@littleho submitted his code 30 times before he got passed the system test." 其中littleho就是一个用户名。我们规定在一段文字中,'@'字符之后一段连续的、非空的大小写英文字母组成的字符串被视为提起的用户名。 给定一段文字...原创 2018-04-07 19:41:20 · 649 阅读 · 0 评论 -
对局匹配
小Hi开发了一个在线玩斗地主的游戏平台。现在平台上有N名用户正在寻找对局,其中第i名用户的积分是Ai。 小Hi希望自己的平台可以自动将这N名用户匹配成尽量多的3人牌局。同时他希望一局中的3名用户两两之间的积分差不超过K。 你能帮小Hi实现这个自动对局匹配的算法吗? 假设现在正有7人在寻找对局,积分分别是[30, 31, 30, 34, 33, 32, 34]并且K = 1,这时最多可以匹配出...原创 2018-04-07 19:23:37 · 1083 阅读 · 0 评论 -
循环数组
给定包含N个整数的数组A1, A2, ... AN,你可以选择任意一个Ai,将Ai旋转到数组第一项,即将数组变成:Ai, Ai+1, Ai+2, ... AN, A1, A2, ..., Ai-1 现在小Hi希望旋转之后的数组满足:对于任意K(1 ≤ i ≤ N),前K项的和都是正数。 例如对于A=[3, -5, 2, -2, 3, 0],旋转成[3, 0, 3, -5, 2, -2]满足条件...原创 2018-04-07 17:11:58 · 138 阅读 · 0 评论 -
相似颜色
E - 相似颜色 HihoCoder - 1700 在CSS中我们可以用井号(#)加6位十六进制数表示一种颜色,例如#000000是黑色,#ff0000是红色,#ffd700是金色。 同时也可以将六位颜色#RRGGBB简写为#RGB三位颜色。例如#000与#000000是相同的,#f00与#ff0000是相同的,#639与#663399是相同的。 对于两个颜色#abcdef和#ghijkl,我...原创 2018-04-07 16:28:01 · 387 阅读 · 0 评论