K. Malek and Summer Semester
 
time limit per test

1.0 s

memory limit per test

256 MB

input

standard input

output

standard output

Malek registered n courses for the summer semester. Malek has a success rate m, which means he has to succeed at least in ceil(n × m)courses out of the n courses, in order to consider the summer semester as a successful semester. Malek is considered successful in the ithcourse, if his grade on this course was greater than or equal to 50.

ceil(x) is the smallest integer greater than or equal to x. For example, ceil(0.95) = 1, ceil(4) = 4, and ceil(7.001) = 8.

Malek will give you his grades in the n courses, and your task is to tell him whether the summer semester was a successful semester or not.

Input

The first line contains an integer T (1 ≤ T ≤ 100), where T is the number of test cases.

The first line of each test case contains an integer n and a real number m (1 ≤ n ≤ 100) (0 < m < 1), where n is the number of courses, and m is the required success rate.

The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 100), where ai is the grade of the ith course.

The success rate m is given with exactly two digits after the decimal point.

Output

For each test case, print a single line containing "YES" (without quotes), if the summer semester was a successful semester for Malek. Otherwise, print "NO" (without quotes).

Example
input
2
5 0.60
45 46 48 48 50
5 0.75
100 99 98 97 100
output
NO
YES

这个题怪自己,自己读错题了,然而是wa2,有点怪异。。。后来眼神好了,改了就过了,大水题。。。

代码:

 1 //K. Malek and Summer Semester-眼瞎
2 #include<iostream>
3 #include<cstring>
4 #include<cstdio>
5 #include<algorithm>
6 #include<cmath>
7 using namespace std;
8 double a[1000];
9 int main(){
10 int t;
11 scanf("%d",&t);
12 while(t--){
13 int n;
14 double m;
15 //cin>>n>>m;
16 scanf("%d%lf",&n,&m);
17 int num=0;
18 memset(a,0,sizeof(a));
19 for(int i=0;i<n;i++)
20 scanf("%lf",&a[i]);
21 int cnt=ceil(n*m);
22 for(int i=0;i<n;i++){
23 if(a[i]>=50)num++;
24 }
25 if(num<cnt)cout<<"NO"<<endl;
26 else cout<<"YES"<<endl;
27 }
28 return 0;
29 }

这是第二次组队赛,和学长们一起训练,第一次的题解还没写,让我休息一会会。。。

感觉很好玩,我的猪队友很给力啊,棒棒棒ヾ(=・ω・=)o

我发现我都读不懂题了,简单的题意看得懂,难一点的题意就靠队友了,鬼知道我英语四级怎么考的。。。

很多很多,超级无穷多的知识都还不会,加油,我和我的猪队友都加油,毕竟我们是宇宙第一帅的队(不接受反驳)

最后放一张图:

溜了溜了(*/ω\*)

Codeforces Gym101502 K.Malek and Summer Semester的更多相关文章

  1. 2017 JUST Programming Contest 3.0 K. Malek and Summer Semester

    K. Malek and Summer Semester time limit per test 1.0 s memory limit per test 256 MB input standard i ...

  2. 『ACM C++』Virtual Judge | 两道基础题 - The Architect Omar && Malek and Summer Semester

    这几天一直在宿舍跑PY模型,学校的ACM寒假集训我也没去成,来学校的时候已经18号了,突然加进去也就上一天然后排位赛了,没学什么就去打怕是要被虐成渣,今天开学前一天,看到最后有一场大的排位赛,就上去试 ...

  3. Codeforces gym102152 K.Subarrays OR

    传送:http://codeforces.com/gym/102152/problem/K 题意:给定$n(n\le10^5)$个数$a_i(a_i\le10^9)$,对于任一个子数组中的数进行或操作 ...

  4. codeforces 1133E K Balanced Teams

    题目链接:http://codeforces.com/contest/1133/problem/E 题目大意: 在n个人中找到k个队伍.每个队伍必须满足最大值减最小值不超过5.求满足条件k个队伍人数的 ...

  5. Codeforces 1133E - K Balanced Teams - [DP]

    题目链接:https://codeforces.com/contest/1133/problem/C 题意: 给出 $n$ 个数,选取其中若干个数分别组成 $k$ 组,要求每组内最大值与最小值的差值不 ...

  6. codeforces 1269E K Integers (二分+树状数组)

    链接:https://codeforces.com/contest/1269/problem/E 题意:给一个序列P1,P2,P3,P4....Pi,每次可以交换两个相邻的元素,执行最小次数的交换移动 ...

  7. codeforces 1282B2. K for the Price of One (Hard Version) (dp)

    链接 https://codeforces.com/contest/1282/problem/B2 题意: 商店买东西,商店有n个物品,每个物品有自己的价格,商店有个优惠活动,当你买恰好k个东西时可以 ...

  8. Codeforces 544E K Balanced Teams (DP)

    题目: You are a coach at your local university. There are nn students under your supervision, the prog ...

  9. Codeforces Gym101502 I.Move Between Numbers-最短路(Dijkstra优先队列版和数组版)

    I. Move Between Numbers   time limit per test 2.0 s memory limit per test 256 MB input standard inpu ...

随机推荐

  1. 基于Centos7.2使用Cobbler工具定制化批量安装Centos7.2系统

    1.1    定制Centos_7_x86_64.ks文件内容 # Cobbler for Kickstart Configurator for CentOS 7.2.1511 by Wolf_Dre ...

  2. COMP9021--6.13

    1. break语句和continue语句都可以在循环中使用,且常与选择结构结合使用,以达到在特定条件满足时跳出循环的作用.break语句被执行,可以使整个循环提前结束.而continue语句的作用是 ...

  3. Makefile基础(一)

    在大型的C语言项目中,一般都是由多个源文件编译链接形成的可执行程序,而这些源文件的处理步骤,通常交给Makefile来管理,Makefile定义了一系列的规则来指定,哪些文件需要先编译,哪些文件需要后 ...

  4. TextView设置缩略显示

    1.代码设置 textview.setSingleLine(); textview.setEllipsiz(TextUtils.TruncateAt.valueOf("END")) ...

  5. Java中String类通过new创建和直接赋值字符串的区别

    方式一:String a = “aaa” ; 方式二:String b = new String(“aaa”); 两种方式都能创建字符串对象,但方式一要比方式二更优. 因为字符串是保存在常量池中的,而 ...

  6. SSM网上商城项目 01

    开发环境与技术选型 操作系统:win7 IDE:Eclipse neno JDK:1.8 数据库:mysql5.6 Dao层:mybatis.数据库连接池(德鲁伊druid) 缓存:redis3.0. ...

  7. day01_10.for循环

    for和while都是一种循环 解释:所有循环的共同点 画图详解 在一条数轴上,循环就是有起始点($i=0); 有结束点($i<=10);有步长($i++); 每走一个相应的步长,就执行一次代码 ...

  8. Mongodb 删除记录里的某个字段

    //例如要把User表中address字段删除 db.User.update({},{$unset:{'address':''}},false, true)

  9. Tensorflow 自适应学习速率

    Tensorflow 自适应学习速率 在模型的初期的时候,往往设置为较大的学习速率比较好,因为距离极值点比较远,较大的学习速率可以快速靠近极值点:而,后期,由于已经靠近极值点,模型快收敛了,此时,采用 ...

  10. python3--类与继承和组合

    类和继承:“是一个”关系 我们已经深入探索了继承的机制,这里举个例子来说明它是如何用于模拟真实世界的关系的.从程序员的角度来看,继承是由属性点号运算启动的,由此触发实例.类以及任何超类中的变最名搜索. ...