【HDOJ6335】Nothing is Impossible(贪心)
题意:
有n道题目m个人,每道题目有1个正确选项和a[i]个错误选项,每个人每道题只能选一个选项
求出最坏情况下分数最多的人至少能拿到几分
n<=1e2,m<=1e9,1<=b[i]<=1e2
思路:
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string.h>
#include <limits.h>
#include <string>
#include <iostream>
#include <queue>
#include <math.h>
#include <stack>
#include <map>
#define left (now<<1)
#define right ((now<<1)+1)
#define mid ((l+r)>>1)
using namespace std;
typedef long long int lint; const int MAXN = 1e2 + ; lint a[MAXN],n,m; int main(){
int t; scanf("%d",&t);
while(t--){
scanf("%d%d",&n,&m);
for(int i = ; i <= n; ++i){
lint b; scanf("%I64d%I64d",&b,&a[i]);
}
sort(a,a++n); lint k = ; lint ans = ;
for(int i = ; i <= n; ++i){
k *= + a[i];
if(m > k){
++ans;
}else{
break;
}
}
printf("%d\n",ans);
}
return ;
}
【HDOJ6335】Nothing is Impossible(贪心)的更多相关文章
- hdu6003 Problem Buyer 贪心 给定n个区间,以及m个数,求从n个区间中任意选k个区间,满足m个数都能在k个区间中找到一个包含它的区间,如果一个区间包含了x,那么 该区间不能再去包含另一个数,即k>=m。求最小的k。如果不存在这样的k,输出“IMPOSSIBLE!”。
/** 题目:hdu6003 Problem Buyer 链接:http://acm.hdu.edu.cn/showproblem.php?pid=6003 题意:给定n个区间,以及m个数,求从n个区 ...
- CF732D. Exams[二分答案 贪心]
D. Exams time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...
- 【BZOJ-4082】Surveillance 树链剖分 LCA + 贪心
4082: [Wf2014]Surveillance Time Limit: 40 Sec Memory Limit: 128 MBSubmit: 260 Solved: 100[Submit][ ...
- UVALive 7146 Defeat the Enemy(贪心+STL)(2014 Asia Shanghai Regional Contest)
Long long ago there is a strong tribe living on the earth. They always have wars and eonquer others. ...
- openjudge8469特殊密码锁[贪心]
描述 有一种特殊的二进制密码锁,由n个相连的按钮组成(n<30),按钮有凹/凸两种状态,用手按按钮会改变其状态. 然而让人头疼的是,当你按一个按钮时,跟它相邻的两个按钮状态也会反转.当然,如果你 ...
- 【BZOJ-1046】上升序列 DP + 贪心
1046: [HAOI2007]上升序列 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 3723 Solved: 1271[Submit][Stat ...
- URAL 2019 Pair: normal and paranormal (贪心) -GDUT联合第七场
比赛题目链接 题意:有n个人每人拿着一把枪想要杀死n个怪兽,大写字母代表人,小写字母代表怪兽.A只能杀死a,B只能杀死b,如题目中的图所示,枪的弹道不能交叉.人和怪兽的编号分别是1到n,问是否存在能全 ...
- Moving Tables(贪心或Dp POJ1083)
Moving Tables Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 28304 Accepted: 9446 De ...
- 01_传说中的车(Fabled Rooks UVa 11134 贪心问题)
问题来源:刘汝佳<算法竞赛入门经典--训练指南> P81: 问题描述:你的任务是在n*n(1<=n<=5000)的棋盘上放n辆车,使得任意两辆车不相互攻击,且第i辆车在一个给定 ...
随机推荐
- elasticsearch-sql安装
Github地址:https://github.com/NLPchina/elasticsearch-sql elasticsearch-sql插件可以方便我们使用SQL语言来对elasticsear ...
- CF781A Andryusha and Colored Balloons
题意: Andryusha goes through a park each day. The squares and paths between them look boring to Andryu ...
- webpack3整理(第三节/满三节)------(base.config文件解释)
'use strict' const path = require('path') const utils = require('./utils') const config = require('. ...
- Eclipse被卡死了或者失去响应了后分析根源的一个小技巧
提升程序员工作效率的工具/技巧推荐系列 推荐一个功能强大的文件搜索工具SearchMyFiles 介绍一个好用的免费流程图和UML绘制软件-Diagram Designer 介绍Windows任务管理 ...
- 语音行业技术领先者Nuance诚招ASR/NLP研发工程师和软件工程师
Nuance is a leading provider of voice and language solutions for businesses and consumers around the ...
- 汇编3栈帧,参数传递,串操作,混合汇编,x64,asm文件
基础知识2 选择结构 通过判断 + 条件跳转指令来实现 循环结构 通过判断 + 条件跳转指令来实现(会有一个向上跳转的语句) 函数调用约定 C调用约定: 由外部平衡栈 标准调用约定 : 由函数内部平衡 ...
- Python3简明教程(九)—— 文件处理
文件是保存在计算机存储设备上的一些信息或数据.你已经知道了一些不同的文件类型,比如你的音乐文件,视频文件,文本文件.Linux 有一个思想是“一切皆文件”,这在实验最后的 lscpu 的实现中得到了体 ...
- GCC、g++编译器和gcc编译器的区别
GCC:(GNU Compiler Collection,GNU编译器套件),是由 GNU 开发的编程语言编译器.它是以GPL许可证所发行的自由软件,也是 GNU计划的关键部分. gcc:GNU的C语 ...
- zabbix auto discovery
1.configuration>discovery>create discovery rule ip range:192.168.43.2-254 check: http 80 2.con ...
- 122. Best Time to Buy and Sell Stock II@python
Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...