- 博客(72)
- 收藏
- 关注
原创 EDITOR NOTTOOBAD - UVa 10602 贪心
Company Macrohard has released it’s new version of editor Nottoobad, which can understand a few voice commands. Unfortunately, there are only two voice commands that it can understand – “repeat the la
2015-02-28 18:45:08 434
原创 Shoemaker's Problem - UVa 10026 贪心
题意:一个鞋匠做鞋,每个鞋都有制作的时间,和延迟制作的处罚,问怎样的顺序才能使处罚达到最低。多种答案的情况下取字典序最小。思路:贪心地去做,每次优先做S/t最大的,同样的情况下,先做标号最小的,保证字典序最小。AC代码如下:#include#include#includeusing namespace std;struct node{ int x,y,num;}bo
2015-02-28 15:00:35 411
原创 Camel trading - UVa 10700 dp
Camel tradingTime Limit: 1 secondBackgroundAroud 800 A.D., El Mamum, Calif of Baghdad was presented the formula 1+2*3*4+5, which had its origin in the financial accounts of a camel trans
2015-02-28 14:21:55 473
原创 Card Collector - HDU 4336 状压期望dp
Card CollectorTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2848 Accepted Submission(s): 1359Special JudgeProblem Description
2015-02-27 19:57:12 484
原创 Help Me Escape - ZOJ 3640 期望dp
Help Me EscapeTime Limit: 2 Seconds Memory Limit: 32768 KBBackground If thou doest well, shalt thou not be accepted? and if thou doest not well, sin lieth at the door. And unto the
2015-02-27 13:17:22 399
原创 Closest Sums - UVa10487 二分
Closest SumsInput: standard inputOutput: standard outputTime Limit: 3 seconds Given is a set of integers and then a sequence of queries. A query gives you a number and asks to find a sum of
2015-02-27 01:14:35 379
原创 Number Sequence - UVa 10706
Number SequenceInput: standard inputOutput: standard outputTime Limit: 1 secondA single positive integer i is given. Write a program to find the digit located in the position i in the sequ
2015-02-27 00:31:30 436
原创 A mid-summer night’s dream - UVa 10057 中位数
题意:求使得求差后绝对值和最小的A的最小值,给定数中有多少个可以满足权值最小,有多少数可以满足权值最小。思路:排序后找中位数,如果是奇数,A就是它,如果是偶数,中间两个数之间的值都可以满足权值最小。AC代码如下:#include#include#includeusing namespace std;int n,num[1000010];int main(){ int
2015-02-27 00:02:27 425
原创 Arthur and Questions - CodeForces 518 E
Arthur and Questionstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter bracket sequences Arthur took up
2015-02-26 22:51:59 578
原创 Ilya and Escalator - CodeForces 518 D 概率dp
Ilya and Escalatortime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIlya got tired of sports programming, le
2015-02-26 22:45:13 717
原创 Going from u to v or from v to u? - POJ 2762 Tarjan+拓扑排序
Going from u to v or from v to u?Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 14959 Accepted: 3956DescriptionIn order to make their sons brave, Jia
2015-02-24 18:29:55 541
原创 Popular Cows - POJ 2186 Tarjan
Popular CowsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 24359 Accepted: 9999DescriptionEvery cow's dream is to become the most popular cow in the
2015-02-24 16:45:29 372
原创 King's Quest - POJ 1904 Tarjan强连通分量
King's QuestTime Limit: 15000MS Memory Limit: 65536KTotal Submissions: 7590 Accepted: 2753Case Time Limit: 2000MSDescriptionOnce upon a time there lived a
2015-02-24 16:01:26 468
原创 Network of Schools - POJ 1236 Tarjan 缩点
Network of SchoolsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 11939 Accepted: 4759DescriptionA number of schools are connected to a computer netwo
2015-02-23 20:22:55 359
原创 迷宫城堡 - HDU 1269 Tarjan 模板题
迷宫城堡Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8401 Accepted Submission(s): 3760Problem Description为了训练小希的方向感,Gardon建立了一
2015-02-23 19:04:21 483
原创 The Maths Lecture - CodeForces 507 D dp
The Maths Lecturetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAmr doesn't like Maths as he finds it real
2015-02-22 15:09:29 549
原创 Breaking Good - CodeForces 507E
Breaking Goodtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBreaking Good is a new video game which a lot
2015-02-22 14:29:00 526
原创 Tanya and Password - CodeForces 508 D 欧拉路径
Tanya and Passwordtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhile dad was at work, a little girl Tan
2015-02-20 16:49:20 466
原创 Arthur and Brackets - CodeForces 508 E dp贪心
Arthur and Bracketstime limit per test2 secondsmemory limit per test128 megabytesinputstandard inputoutputstandard outputNotice that the memory limit is non-sta
2015-02-20 15:02:24 480
原创 Restoring Numbers - CodeForces 509 D
Restoring Numberstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya had two arrays consisting of non-neg
2015-02-20 14:27:09 451
原创 Drazil and Tiles - CodeForces 513 D 搜索
Drazil and Tilestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDrazil created a following problem about p
2015-02-19 18:24:10 580
原创 Drazil and Factorial - CodeForces 513 C 水题
Drazil and Factorialtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDrazil is playing a math game with Var
2015-02-19 18:19:35 1124
原创 Dog Distance - UVa 11796 几何
题意:给你两条狗的行走路径,然后他们同时开始同时到达,问他们之间距离的最大值和最小值之差是多少。思路:首先每次从当前状态到有一只狗到达一个点的时候为止,这段时间内,可以知道两条狗的开始位置和位移状态,假设A不动,然后求一个点到线段的最小值,就是这段时间内的最短距离。最长距离就是这段时间内开始和结束时的最大距离。AC代码如下:#include#include#include#inc
2015-02-19 18:10:38 453
原创 That Nice Euler Circuit - POJ 2284 欧拉公式
That Nice Euler CircuitTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 1790 Accepted: 560DescriptionLittle Joey invented a scrabble machine that he ca
2015-02-19 15:27:57 375
原创 Morley’s Theorem - UVa 11178 求直线交点
Morley’s TheoremInput: Standard InputOutput: Standard Output Morley’s theorem states that that the lines trisecting the angles of an arbitrary plane triangle meet at the vertices of an equilater
2015-02-18 18:23:31 457
原创 Malfatti Circles - POJ 3808 几何
Malfatti CirclesTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 239 Accepted: 122 Special JudgeDescriptionThe configuration of three circles packed
2015-02-18 17:15:54 537
原创 Triangle Hazard - UVa 12165 几何
题意:给你P Q R的坐标,和m1-m6的长度,求ABC的坐标。思路:我就是个几何弱渣,借鉴的别人的代码,想了好久还是没看明白,最终决定当成模板来用了QAQAC代码如下:#include#includeusing namespace std;struct Point{ double x,y; Point(double x=0,double y=0):x(x),y
2015-02-18 16:17:18 602
原创 Circum Triangle - UVa 11186 三角形面积
Circum Triangle Input: Standard InputOutput: Standard Output You will be given N distinct points on the boundary of a circle whose center is at the origin. As the points are on the same circle
2015-02-18 14:59:39 581
原创 Cows and Cars - 概率dp 对题目发出质疑
Cows and CarsInput: standard inputOutput: standard outputTime Limit: 4 secondsIn television contests, participants are often asked to choose one from a set of or doors for example, one or
2015-02-17 19:33:46 528
原创 What is the Probability - UVa 10056 概率
题意:从1-n轮回掷骰子,每个人每次有p的概率赢,问第m个人赢的概率。思路:设其为ans,ans=P(前m-1人个都没中)*p+P(n个人都没中)*ans。 整理后为ans=p*pow(q,m-1)/(1-pow(q,n)); q=1-p。AC代码如下:#include#include#includeusing namespace std;int T,t
2015-02-17 17:42:48 512
原创 Palindromic Permutation - UVa 11027 组合数
Given a string of characters, we can permute the individual characters to make new strings. We can then order these strings into alphabetical order. For example the string ‘abba’ gives rise to the
2015-02-17 16:53:09 359
原创 Choose and divide - UVa 10375
The binomial coefficient C(m,n) is defined as m!C(m,n) = -------- n!(m-n)!Given four natural numbers p, q, r, and s, compute the the result of dividing C(p,q) by C(r,s).
2015-02-16 16:30:42 446
原创 Polynomial Coefficients - UVa 10105 多项式系数
题意:给你(x1+x2+....+xk)^n的式子,然后给定所有x的次方,问这个它的系数是多少。思路:组合数c(n,k),不用多说。AC代码如下:#include#includeusing namespace std;int n,m,c[20][20],num[20],sum[20],ans;int main(){ int i,j,k; for(i=0;i<=
2015-02-16 15:02:38 540
原创 Kids and Prizes - SGU 495
Kids and PrizesTime limit per test: 0.25 second(s)Memory limit: 262144 kilobytesinput: standardoutput: standardICPC (International Cardboard Producing Company) is in the business
2015-02-15 22:35:50 427
原创 Watto and Mechanism - CodeForces 514 C Trie树
Watto and Mechanismtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWatto, the owner of a spare parts store
2015-02-15 03:18:52 1343
原创 R2D2 and Droid Army - CodeForces 514 D 二分
R2D2 and Droid Armytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn army of n droids is lined up in one
2015-02-15 03:17:54 552
原创 Bag of mice - CodeForces 148 D 概率dp
Bag of micetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe dragon and the princess are arguing about w
2015-02-14 18:06:52 459
原创 You Are the One - HDU 4283 dp
You Are the OneTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1829 Accepted Submission(s): 866Problem Description The TV sh
2015-02-14 17:00:08 467
原创 Food Delivery - ZOJ 3469 dp
Food DeliveryTime Limit: 2 Seconds Memory Limit: 65536 KBWhen we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At this
2015-02-14 16:19:37 455
原创 Coloring Brackets - CodeForces 149 D dp
Coloring Bracketstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOnce Petya read a problem about a bracket
2015-02-14 15:36:35 478
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人