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

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
#define ll long long
const int maxn=100005;
int a[105];
int main()
{
// freopen("in.txt","r",stdin);
int T,n;
double m;
scanf("%d",&T);
while(T--)
{
scanf("%d%lf",&n,&m);
double guo=n*m;
int guo1=ceil(guo);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
int ans=0;
for(int i=0;i<n;i++)
{
if(a[i]>=50)
ans++;
}
if(ans>=guo1)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
}

2017 JUST Programming Contest 3.0 K. Malek and Summer Semester的更多相关文章

  1. 2017 JUST Programming Contest 3.0 I. Move Between Numbers

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

  2. 2017 JUST Programming Contest 3.0 E. The Architect Omar

    E. The Architect Omar time limit per test 1.0 s memory limit per test 256 MB input standard input ou ...

  3. 2017 JUST Programming Contest 2.0 题解

    [题目链接] A - On The Way to Lucky Plaza 首先,$n>m$或$k>m$或$k>n$就无解. 设$p = \frac{A}{B}$,$ans = C_{ ...

  4. gym101532 2017 JUST Programming Contest 4.0

    台州学院ICPC赛前训练5 人生第一次ak,而且ak得还蛮快的,感谢队友带我飞 A 直接用claris的模板啊,他模板确实比较强大,其实就是因为更新的很快 #include<bits/stdc+ ...

  5. gym101343 2017 JUST Programming Contest 2.0

    A.On The Way to Lucky Plaza  (数论)题意:m个店 每个店可以买一个小球的概率为p       求恰好在第m个店买到k个小球的概率 题解:求在前m-1个店买k-1个球再*p ...

  6. 2017 JUST Programming Contest 2.0

    B. So You Think You Can Count? 设dp[i]表示以i为结尾的方案数,每个位置最多往前扫10位 #include<bits/stdc++.h> using na ...

  7. 2017 JUST Programming Contest 3.0 B. Linear Algebra Test

    B. Linear Algebra Test time limit per test 3.0 s memory limit per test 256 MB input standard input o ...

  8. 2017 JUST Programming Contest 3.0 D. Dice Game

    D. Dice Game time limit per test 1.0 s memory limit per test 256 MB input standard input output stan ...

  9. 2017 JUST Programming Contest 3.0 H. Eyad and Math

    H. Eyad and Math time limit per test 2.0 s memory limit per test 256 MB input standard input output ...

随机推荐

  1. Go --- 设计模式(模板模式)

    模版模式真的是一个好东西.所谓模版模式,就是说,某几个类中相同的操作和代码提取到父类的一个函数中,并定义相同的操作为抽象函数.由子类来实现.估计我也没表达清楚,下面还是看代码来讲解吧. 例:我们有两个 ...

  2. JVM原理及内存溢出

    JVM原理及内存溢出

  3. python手记(53)

    import sys import pygame from pygame.locals import * import time import math pygame.init() screen=py ...

  4. Linux程序设计(搭建开发环境--curses)

    看官们.咱们今天要说的内容.是前面内容的一点小补充,详细的内容是:安装curses开发包.以搭建 开发环境.闲话休说,言归正转. 我们在前面说过搭建开发环境的内容,主要说了开发环境中的GCC和VIM, ...

  5. Asp.net MVC 简单分页 自做简单分页

    Asp.net MVC 简单分页:   public static string Pager(int page,int pageSize,int total)         {           ...

  6. 机器学习和深度学习笔记(Matlab语言实现)

    不多说,直接上干货! 这里,对于想用matlab语言来做的朋友,强烈推荐 http://www.cnblogs.com/tornadomeet/

  7. 使用HD/IDE层的ioctl接口获取磁盘容量get_hdd_max_sector

    利用HD/IDE layer的ioctl函数接口获取HD/IDE的磁盘容量.HDIO_DRIVE_TASK  能发出訪问LBA地址的命令.但不能读写数据. #include <stdio.h&g ...

  8. excel 学习

    最近越來越感覺到熟練運用office軟件是一門很深的學問,以前一直忽視了這個技能,因爲從來都不覺得這個有什麼技術難度.正是因爲這樣想,所以才一直沒能去好好研究使用這套工具.現在卻覺得有必要學習,在於: ...

  9. while语句字符串的基本操作

    1,编码:对现在通用文字编码成计算机文字,便于储存,传递,交流. 最早的计算机编码是ACSII美国人创建的,包含英文字母,数字,以及特殊符号.总共是128个码位:2**7,因为计算机的底层只能识别:& ...

  10. WEB 字体

    之前如果想在自己的网站使用某些好看的字体,总是迫不得已得在PS里先把字体图片做好.虽然这样做也能达到我们想要的效果,但是这样就增加了HTTP请求 (如果在多处使用的话),即使合并所有图片,也不好管理, ...