https://vjudge.net/contest/313233#problem/D

Input

The first line of the input contains an integer TT (1≤T≤100)(1≤T≤100) denoting the number of test cases. 
Each test case starts with two integers n,m (1≤n≤100,1≤m≤109)(1≤n≤100,1≤m≤109), denoting the number of problems and the number of students. Each of next nn lines contains two integers ai,biai,bi ( 1≤bi≤100,ai=11≤bi≤100,ai=1), indicating the number of correct answers and the number of incorrect answers of the ii-th problem.

Output

For each test case, print an integer denoting the maximum size of SS. 
Sample Input

2
3 5
1 3
1 3
1 3
5 50
1 1
1 3
1 2
1 3
1 5

Sample Output

1
3

题意:
N 个题 M 次作答(依次作答,每题可重复作答)
每个题的正确/错误答案分布在下面 N 行给出
每个题在取过所有的错误答案后才会有一个正确答案。
问最终选中正确答案的个数

要让一道题的所有错误答案都被选中,才能保证至少选对一个正确答案。

code
 1 #include <cstdio>
2 #include <iostream>
3 #include <algorithm>
4 using namespace std;
5 int main()
6 {
7 int t;
8 int n , m;
9 cin >> t;
10 while(t--)
11 {
12 cin >> n >> m;
13 int b[110] = {0};
14 for(int i = 0;i<n;i++)
15 scanf("%*d%d" , &b[i]);
16 sort(b , b+n);
17 int sum = 0;
18 for(int i = 0;i<n;i++)
19 {
20 if(m < b[i]+1)
21 break;
22 m /= b[i]+1;
23 sum++;
24 }
25 cout << sum << endl;
26 }
27 return 0;
28 }
 

D - Problem D. Nothing is Impossible HDU - 6335的更多相关文章

  1. HDU 6335.Problem D. Nothing is Impossible-思维题 (2018 Multi-University Training Contest 4 1004)

    6335.Problem D. Nothing is Impossible 题意:给你n道题目,m个人,每题有x个正确选项,y个错误选项,问你做对题数量最多的人做对了多少道题目. 如果一道题有y个错误 ...

  2. A simple problem 分类: 哈希 HDU 2015-08-06 08:06 1人阅读 评论(0) 收藏

    A simple problem Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) To ...

  3. Problem B. Harvest of Apples HDU - 6333(莫队)

    Problem Description There are n apples on a tree, numbered from 1 to n.Count the number of ways to p ...

  4. Problem F. Grab The Tree HDU - 6324

    题意:给出一棵n个节点的树,每个节点有一个权值,Q和T玩游戏,Q先选一些不相邻的节点,T选剩下的节点,每个人的分数是所选节点的权值的异或和,权值大的胜出,问胜出的是谁. 题解: 话说,这题后面的边跟解 ...

  5. 构造 - HDU 5402 Travelling Salesman Problem

    Travelling Salesman Problem Problem's Link: http://acm.hdu.edu.cn/showproblem.php?pid=5402 Mean: 现有一 ...

  6. HDU 3947 River Problem

    River Problem Time Limit: 2000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ...

  7. HDU 4975 A simple Gaussian elimination problem.

    A simple Gaussian elimination problem. Time Limit: 1000ms Memory Limit: 65536KB This problem will be ...

  8. HDU 4971 A simple brute force problem.

    A simple brute force problem. Time Limit: 1000ms Memory Limit: 65536KB This problem will be judged o ...

  9. POJ 3691 &amp; HDU 2457 DNA repair (AC自己主动机,DP)

    http://poj.org/problem?id=3691 http://acm.hdu.edu.cn/showproblem.php?pid=2457 DNA repair Time Limit: ...

  10. HDU 1498 50 years, 50 colors(最小点覆盖,坑称号)

    50 years, 50 colors Problem Description On Octorber 21st, HDU 50-year-celebration, 50-color balloons ...

随机推荐

  1. AI到底给我们带来什么?

    AI 如火如荼,尤其是最近半年,发展的速度超出想象.DeepSeek的出现,对于整个世界AI 界带来深渊影响. AI是当前"技术找技术"的极致产物, 它大幅提升了流程效率,但没有带 ...

  2. 【实战】Rust与前端协同开发:基于Tauri的跨平台AI阅读器实践

    一.背景与目标:为什么做一个"非典型"的RSS阅读器? 在信息爆炸的时代,RSS依然是高效获取结构化内容的重要方式,但市面上主流阅读器要么功能冗余(如集成社交属性),要么技术栈陈旧 ...

  3. K8s进阶之LimitRange

    概述 官方文档:https://kubernetes.io/zh-cn/docs/concepts/policy/limit-range/ 在 Kubernetes(K8s)中,LimitRange ...

  4. SQL语句between and边界问题

       BETWEEN AND 需要两个参数,即范围的起始值a和终止值b,而且要求a<b.如果字段值在指定的[闭区间[a,b]]内,则这些记录被返回:否则,记录不会被返回. 字段值可以是数值.文本 ...

  5. Joomla设计理念探讨系列2 -程序员要如何用代码实现“白纸幻想”?

    客户幻想拖拖拽拽就建站?程序员连夜拆解出网格化背后的技术深渊. 1. 破灭的白纸幻想?不,是技术逻辑的碰撞 当客户兴奋地描述"白纸网格"时,程序员的第一反应往往是: "需 ...

  6. [书籍精读]《响应式Web设计 HTML5和CSS3实战(第二版)》精读笔记分享

    写在前面 书籍介绍:本书主要讲解了如何运用HTML5和CSS3来进行响应式Web设计,使页面的设计与开发根据用户行为以及设备环境(系统平台.屏幕尺寸.屏幕定向等)来进行相应的响应和调整. 我的简评:响 ...

  7. 数栈SQL优化案例:OR条件优化

    本文整理自:袋鼠云技术荟 | SQL优化案例(2):OR条件优化 数栈是云原生-站式数据中台PaaS,我们在github上有一个有趣的开源项目:https://github.com/DTStack/f ...

  8. 程序与用户交互(input、print)

    程序与用户交互 [1]输入(input) (1)input 输入一些内容后,按下回车键后,input函数会返回用户输入的内容 input接受的所有数据类型都是str类型 username = inpu ...

  9. Spring AOP 面向切面编程深度解析

    在 Spring 生态系统中,面向切面编程(AOP) 是实现横切关注点分离的核心机制,通过将日志.事务.权限等通用功能从业务逻辑中解耦,提升代码可维护性与复用性.本文从核心概念.实现原理.通知类型及面 ...

  10. Java中什么是类加载?类加载的过程?

    类加载指的是把类加载到 JVM 中.把二进制流存储到内存中,之后经过一番解析.处理转化成可用的 class 类 二进制流可以来源于 class 文件,或通过字节码工具生成的字节码或来自于网络.只要符合 ...