当前位置:网站首页>2020ccpc Qinhuangdao exam results (ruler)
2020ccpc Qinhuangdao exam results (ruler)
2022-07-18 01:38:00 【51CTO】
7-5 Exam Results
Professor Alex is preparing an exam for his students now.
There will be n students participating in this exam. If student i has a good mindset, he/she will perform well and get ai points. Otherwise, he/she will get bi points. So it is impossible to predict the exam results. Assume the highest score of these students is x points. The students with a score of no less than x⋅p% will pass the exam.
Alex needs to know what is the maximum number of students who can pass the exam in all situations. Can you answer his question?
Input
The first line of the input gives the number of test cases, T (1≤T≤5×103). T test cases follow.
For each test case, the first line contains two integers n (1≤n≤2×105) and p (1≤p≤100), where n is the number of students and p% is the ratio.Each of the following n lines contains two integers ai,bi (1≤bi≤ai≤109), representing the scores of student i.
The sum of n in all test cases doesn’t exceed 5×105.Output
For each test case, output one line containing “Case #x: y”, where x is the test case number (starting from 1), and y is the maximum number of students.
Sample Input
Sample Output
The question
Give you A student , Each student has two grades , You can choose one of these two grades , How many people let you pass the exam ? The condition for passing is : Go here n Multiply the highest score of students by %p This is the passing line . Less than this score, you will fail .
Ideas :
We can find from the meaning of the question that if we reduce the maximum pass line, the attendance will be reduced , Similarly, we should also improve the maximum passing line , So the difficulty we need to solve is here . First let's look at , The condition is that it will be pulled out Students, this is certain , Then choose the one with the highest score , We can give this first
Overall ranking of grades , So we can easily find the biggest , Then I wonder how to know which score this student chooses or whether this student participates in the score selection , Then we need to mark , use
The array marks whether the current point is all pop fall .
Take with ruler : Because we are entering elements on one side , Enter the largest one , The one who comes out with another element is unqualified ( Think the maximum score is improving , The passing score is also improved ) This is a typical ruler .
Look at the code specifically .
This question is inexplicably stuck long long I don't know why .
Code
边栏推荐
- 进一步提升数字、智能化水准,亚洲狮首次产品焕新售价14.15万起
- 001层次选择器
- Codeforces Round #806 (Div. 4)
- IDEA 设置 / 修改快捷键
- Excel fast l count the number of red data in all lines [commonly used in teaching]
- 【LaTex 中英文样式&加粗】自由选择中英文字体样式,中英文字体粗黑程度设置
- 002后代选择器
- UML类图
- 坚持写下去的原因
- Matlab bottom source code realizes image corrosion and expansion operation (consistent with Halcon effect)
猜你喜欢

An OTL power amplifier circuit with a new vest

Mobile browser product analysis

Matlab bottom source code to realize image dynamic binarization

Matlab底层源代码实现图像腐蚀,膨胀操作(与Halcon效果一致)

Pytoch (II) -- main components of pytorch

030. deletion and link of documents

To further improve the digital and intelligent level, Asia lion's first product is refreshed, with a price of 141500

MFC student achievement management system
![Excel fast l count the number of red data in all lines [commonly used in teaching]](/img/08/4023f0f31f79086662ae4cee722a2b.png)
Excel fast l count the number of red data in all lines [commonly used in teaching]

Restore of data encryption returned by a website
随机推荐
【Verilog】32位单精度浮点数比较大小
C语言实现简单扫雷游戏(二维数组)
QT implementation hash table dynamic demonstration
MFC宠物商店信息管理系统
C. K-beautiful Strings
node 连接数据库进行增删改查
Good people are late acquaintances
AB test command
001层次选择器
对接企业微信,客户关系管理也可以很简单!
cdn加速是什么
Dbpack read / write separation function release announcement
Matlab bottom source code realizes image corrosion and expansion operation (consistent with Halcon effect)
System.arraycopy的使用和参数含义详解
An OTL power amplifier circuit with a new vest
C语言实现手机通讯录
Matlab底层源代码实现图像腐蚀,膨胀操作(与Halcon效果一致)
保持电气化时代的交通安全“零伤亡”,沃尔沃底气何来?
【LaTex 中英文样式&加粗】自由选择中英文字体样式,中英文字体粗黑程度设置
C语言实现三子棋