
ac
ZAX1
这个作者很懒,什么都没留下…
展开
-
D - Milking Time【DP】
Bessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to schedule her nextN(1 ≤N≤ 1,000,000) hours (conveniently labeled 0..N-1) so that she...原创 2018-10-30 18:27:35 · 330 阅读 · 0 评论 -
H. 蛇形矩阵 Plus 题解【递推找规律】
题意:输入一个常数n,求出n阶螺旋方阵的每一行的和。思路:首先我想到的是直接写一个求螺旋矩阵的程序,把每一行的和直接求出来,但是后来我发现这个题数据很大,这个方法只能过几个用例,所以肯定有特殊的方法求解。于是我们想到了找规律递推一下。举个例子,先观察n = 9的时候。对应的蛇形矩阵如下1 2 3 4 5 6 7 8 932 33 34 35 36 37 38 39 10...原创 2019-02-01 22:18:43 · 466 阅读 · 0 评论 -
Inversion II
题目描述Let { A1,A2,...,An } be a permutation of the set{ 1,2,..., n}. If i < j and Ai > Aj then the pair (Ai,Aj) is called an "inversion" of the permutation. For example, the permutation {3, ...原创 2019-04-17 17:32:58 · 503 阅读 · 0 评论 -
Swordfish【prim算法】
题目描述There exists a world within our worldA world beneath what we call cyberspace.A world protected by firewalls,passwords and the most advancedsecurity systems.In this world we hideour deepest...原创 2019-04-17 17:32:25 · 251 阅读 · 0 评论 -
Mining【模拟,优先级队列】
题目描述A mining base needs to build some robots to collect at least 10000 units of resource. Each robot will start from the base, reach the diggings in S minutes, work for W minutes, and then take C un...原创 2019-04-17 17:31:20 · 226 阅读 · 0 评论 -
Ayoub and Lost Array【dp】
Ayoub had an arrayaaof integers of sizennand this array had two interesting properties:All the integers in the array were betweenllandrr(inclusive). The sum of all the elements was divisibl...原创 2019-03-05 18:38:17 · 247 阅读 · 0 评论 -
Puzzle 【字符串输入包含空格处理】
原题地址#include <iostream>#include <cstring>using namespace std;int f;char order[10000];char orderplus[10000];string map[5];void swap(char &a,char &b){ char c; c...原创 2019-03-02 18:09:47 · 221 阅读 · 0 评论 -
HUD 1166 敌兵布阵(树状数组或者线段树)【树状数组】
#include<iostream>#include<cstring>using namespace std;int n;int a[50001];int b[40001];int lowbit(int i){ return i&(-i);}void update(int x,int val){ while(x<=n) ...原创 2019-03-06 12:51:32 · 159 阅读 · 0 评论 -
Divide and Count【排列组合】
题目描述Jack has several beautiful diamonds, each of them is unique thus precious. To keep them safe, he wants to divide and store them in different locations. First, he has bought some coffers. These b...原创 2019-02-27 10:27:16 · 243 阅读 · 0 评论 -
蓝桥杯历届试题——大臣的旅费【DFS】
历届试题 大臣的旅费 时间限制:1.0s 内存限制:256.0MB问题描述很久以前,T王国空前繁荣。为了更好地管理国家,王国修建了大量的快速路,用于连接首都和王国内的各大城市。为节省经费,T国的大臣们经过思考,制定了一套优秀的修建方案,使得任何一个大城市都能从首都直接或者通过其他大城市间接到达。同时,如果不重复经过大城市,从首都到达每个大城市的方案都是唯一...原创 2019-03-23 14:23:31 · 153 阅读 · 0 评论 -
Codeforces Gym-101116-F (Flight Plan)【三角函数】
原文地址题目大意:假设地球是一个球体,给出起点的经纬度A(x1,y1),A(x1,y1), 终点的经纬度B(x2,y2)B(x2,y2)。x:x: 纬度,北纬为正,南纬为负;y:y: 经度,东经为正,西经为负。令:D1D1为两点的距离;D2D2为起点AA先沿着纬线,再沿着经线 走到终点BB的距离。求D1,D2求D1,D2。数据范围:1≤T≤100001≤T≤10...转载 2019-04-10 13:04:27 · 191 阅读 · 0 评论 -
Apple Catching【DP】
It is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, each full of apples. Bessie cannot reach the apples when they a...原创 2018-10-30 14:27:46 · 467 阅读 · 0 评论 -
D - Keiichi Tsuchiya the Drift King【三角函数】
D - Keiichi Tsuchiya the Drift KingDrifting is a driving style in which the driver uses the throttle, brakes, clutch, gear shifting and steering input to keep the car in a state of oversteer whil...原创 2019-04-17 17:27:38 · 578 阅读 · 0 评论 -
UVa 11584 Partitioning by Palindromes(DP 最少回文串)
原题地址题意 :判断一个串最少可以分解为多少个对称串 一个串从左往后和从右往左是一样的 这个串就称为对沉串思路:令d[i]表示给定串的前i个字母至少可以分解为多少个对称串 那么对于j=1~i 若(j,i)是一个对称串 那么有 d[i]=min(d[i],d[j-1]+1) 然后就得到答案了#include<iostream>#incl...原创 2018-11-27 19:55:15 · 187 阅读 · 0 评论 -
uva 11400 - Lighting System Design(dp)
原题地址关于题意解释#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#include<set>#include<queue>#include<stack>...原创 2018-11-27 19:01:39 · 183 阅读 · 1 评论 -
B - Frequent values UVA - 11235【RMQ】
原题地址题意:给出一组长度为N数,该数列非递减,然后给出q个区间对于每个区间,求出其中的众数的个数,就是出现次数最多的数的个数。思路:因为数据范围大,暴力会超时,需要特殊的算法,我们可以把这些数分为一段一段的,每一段的数是相同的,用cnt[i]表示第i个段对应的长度,即里面相同的数的数量。我们可以在输入数列a[i]时把每个数都划到一个个段中,每个段中的值都是相同的,这样每个段都...原创 2018-11-23 13:43:08 · 198 阅读 · 0 评论 -
E - Cheapest Palindrome【DP】
Keeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID tag that the system will read as the cows pass by...原创 2018-10-30 20:06:08 · 232 阅读 · 0 评论 -
I - Wooden Sticks
There is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashion. It needs some time, called ...原创 2018-11-03 11:44:35 · 154 阅读 · 0 评论 -
poj1742 多重背包
People in Silverland use coins.They have coins of value A1,A2,A3...An Silverland dollar.One day Tony opened his money-box and found there were some coins.He decided to buy a very nice watch in a nearb...原创 2018-11-03 13:33:25 · 169 阅读 · 0 评论 -
C - Cheerleaders
In most professional sporting events, cheerleaders play a major role in entertaining the spectators. Their roles are substantial during breaks and prior to start of play. The world cup soccer is no ex...原创 2018-11-06 21:10:01 · 368 阅读 · 0 评论 -
奶牛博览会——双背包问题
原文地址时间限制: 1 Sec 内存限制: 128 MB 题目描述 奶牛想证明他们是聪明而风趣的。为此,贝西筹备了一个奶牛博览会,她已经对N头奶 牛进行了面试,确定了每头奶牛的智商和情商。贝西有权选择让哪些奶牛参加展览。由于负的智商或情商会造成负面效果,所以贝西不希望出展奶牛的智商之和小于零,或情商之和小于零。满足这两个条件下,她希望出展奶牛的智商与情商之和越大越好,请帮助贝西求出...转载 2018-11-05 11:40:58 · 379 阅读 · 0 评论 -
poj1631(最长上升子序列 nlogn)
'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed up completely, making the signals on the chip connecting the ports...原创 2018-11-05 11:47:37 · 306 阅读 · 0 评论 -
UVA - 10780 Again Prime? No Time. (质因子分解)
Again Prime? No time.Input: standard inputOutput: standard outputTime Limit: 1 secondThe problem statement is very easy. Given a number n you have to determine the largest power of m, not necess...原创 2018-11-13 19:46:41 · 162 阅读 · 0 评论 -
Taxi drivers and Lyft
G - Taxi drivers and Lyft Palo Alto is an unusual city because it is an endless coordinate line. It is also known for the office of Lyft Level 5.Lyft has become so popular so that it is now used...原创 2018-11-08 16:43:46 · 603 阅读 · 0 评论 -
求GCD(最大公约数)的算法
int GCD ( int a , int b) //递归版{ if ( b != 0 ) return GCD( b, a%b ); return a;}int GCD ( int a , int b) //非递归版{ int c; while (b) { c = a; a = b; b = ...原创 2018-11-12 17:25:00 · 274 阅读 · 0 评论 -
long long 范围【常识】
unsigned int 0~4294967295 (10位数,4e9)int -2147483648~2147483647 (10位数,2e9 2^31 - 1) long long: -9223372036854775808~9223372036854775807 (19位数, 9e18 )...原创 2018-11-14 20:39:12 · 25304 阅读 · 0 评论 -
A - Ping pong(树状数组+顺序对)
Time Limit : 2000/1000ms (Java/Other)Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 81Accepted Submission(s) : 27Problem DescriptionN(3<=N<=20000) ping pong players live ...原创 2018-11-22 17:17:46 · 410 阅读 · 0 评论 -
Palindrome Numbers【模拟】
Palindrome NumbersTime Limit:1000MS Memory Limit:65536KTotal Submissions:3948 Accepted:1505Descr...原创 2018-11-17 15:56:09 · 243 阅读 · 0 评论 -
Farm Irrigation【DFS】
Problem DescriptionBenny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes are placed in these squares. Different square has ...原创 2019-04-17 17:30:22 · 145 阅读 · 0 评论