标签:str clu ring scanf 情况下 lin span bubuko ssi
题意:
有n道题目m个人,每道题目有1个正确选项和a[i]个错误选项,每个人每道题只能选一个选项
求出最坏情况下分数最多的人至少能拿到几分
n<=1e2,m<=1e9,1<=b[i]<=1e2
思路:
1 #include <stdio.h> 2 #include <vector> 3 #include <algorithm> 4 #include <string.h> 5 #include <limits.h> 6 #include <string> 7 #include <iostream> 8 #include <queue> 9 #include <math.h> 10 #include <stack> 11 #include <map> 12 #define left (now<<1) 13 #define right ((now<<1)+1) 14 #define mid ((l+r)>>1) 15 using namespace std; 16 typedef long long int lint; 17 18 const int MAXN = 1e2 + 10; 19 20 lint a[MAXN],n,m; 21 22 int main(){ 23 int t; scanf("%d",&t); 24 while(t--){ 25 scanf("%d%d",&n,&m); 26 for(int i = 1; i <= n; ++i){ 27 lint b; scanf("%I64d%I64d",&b,&a[i]); 28 } 29 sort(a,a+1+n); lint k = 1; lint ans = 0; 30 for(int i = 1; i <= n; ++i){ 31 k *= 1 + a[i]; 32 if(m > k){ 33 ++ans; 34 }else{ 35 break; 36 } 37 } 38 printf("%d\n",ans); 39 } 40 return 0; 41 }
【HDOJ6335】Nothing is Impossible(贪心)
标签:str clu ring scanf 情况下 lin span bubuko ssi
原文地址:https://www.cnblogs.com/myx12345/p/9406565.html