UVA - 1612 Guess (猜名次)(贪心)】的更多相关文章

题意:有n(n<=16384)位选手参加编程比赛.比赛有3道题目,每个选手的每道题目都有一个评测之前的预得分(这个分数和选手提交程序的时间相关,提交得越早,预得分越大).接下来是系统测试.如果某道题目未通过测试,则该题的实际得分为0分,否则得分等于预得分.得分相同的选手,ID小的排在前面. 已知所有人的预得分,以及最终的排名,问这个排名是否可能存在,若存在,输出最后一名的最高可能得分:否则,输出No solution.每个预得分均为小于1000的非负实数,最多保留两位小数. 分析: 1.因为要保…
题意:有 n 位选手参加编程比赛.比赛有3道题目,每个选手的每道题目都有一个评测之前的预得分(这个分数和选手提交程序的时间相关,提交的越早,预得分越大). 接下来 是系统评测.如果某道题未通过测试,则改题的实际得分为0分,否则得分等于预得分.得分相同的选手,ID小的排在前面. 问是否能给出所有3n个得分以及最后的实际名次.如果可能,输出最后一名的最高可能得分.每个预得分均为小于1000的非负实数,最多保留两位小数. 析:首先这个题是一个水题,一点也不难,我就卡在题意上了,卡了一下午,吃饭回来又读…
这道题我很快就写出来了, 但是一直WA, 然后发现是精度, 这坑了我一个小时-- (1)贪心.每次就尽量分数高, 可以保证最后分数最高 (2)神tm精度问题.记住判断大于小于和等于的时候要用EPS(1e-6) a == b                  fabs(a-b) < EPS a != b                  fabs(a-b) > EPS a < b                   a + EPS < b a <= b             …
题意:已知 N 位选手的3题的预期得分,得分要不全拿,要不为0.且知道最后的实际名次,而且得分相同的选手,ID小的排在前面.问这样的名次可能吗.若可能,输出最后一名的最高可能得分.(N≤16384) 解法:(P.S.现在让我来做个口胡选手......(-o-) 不打算打代码了.)我有2种想法:1.排序+扫描法.将 N 位选手可能得到的所有分数 N*(1+3+3+1)>10^5 算出来,全部一起按从大到小的顺序排一次序.再扫描一遍,依次选出名次排行中当前排名的选手第一个出现的分数作为该选手的分数,…
Yup!! The problem name reects your task; just add a set of numbers. But you may feel yourselvescondescended, to write a C/C++ program just to add a set of numbers. Such a problem will simplyquestion your erudition. So, lets add some avor of ingenuity…
We would like to place n rooks, 1 n 5000, on a n nboard subject to the following restrictions• The i-th rook can only be placed within the rectan-gle given by its left-upper corner (xli; yli) and its right-lower corner (xri; yri), where 1 i n, 1 xli…
这道题真是WA得我心力交瘁,好讨厌的感觉啊! 简直木有写题解的心情了 题意: n×n的棋盘里,放置n个车,使得任意两车不同行且不同列,且第i个车必须放在给定的第i个矩形范围内.输出一种方案,即每个车的坐标,无解的话则输出“IMPOSSIBLE” 行和列是独立的,所以可以分开处理,将二维的转化成了一维区间上的取点问题: 有一个长度为n的区间,还有n个小区间,求一种方案,在每个小区间的范围取一个点,是的大区间上每个单位1的区间里都有点. 开始写的贪心是错误的: 按区间的左端点从小到大排序,然后右端点…
题目链接: C - Grid of Lamps Time Limit:1000MSMemory Limit: 0KB 问题描述 We have a grid of lamps. Some of the lamps are on, while others are off. The luminosity of a row/column is the number of its lighted lamps. You are given a permutation of the luminositie…
  Product of digits  For a given non-negative integer number N , find the minimal natural Q such that the product of all digits of Q is equal N . Input The first line of input contains one positive integer number, which is the number of data sets. Ea…
Commando War There is a war and it doesn't look very promising for your country. Now it's time to act. You have a commando squad at your disposal and planning an ambush on an important enemy camp located nearby. You have N soldiers in your squad. In…