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. spring mvc 集成freemarker模板

    主要使用到的jar 文件:spring mvc +freemarker.jar 第一步:spring mvc 集成 freemarker <!-- 定义跳转的文件的前后缀 ,视图模式配置--&g ...

  2. leetcode ----Trie/stack专题

    一:Implement Trie (Prefix Tree) 题目: Implement a trie with insert, search, and startsWith methods. Not ...

  3. 打造极致性能数据库中间件丨LVS+Keepalive+华为云DDM之理论篇

    背景说明 华为云分布式数据库中间件(Distributed Database Middleware,简称DDM),专注于解决数据库分布式扩展问题,突破了传统数据库的容量和性能瓶颈,实现海量数据高并发访 ...

  4. 6 使用Ionic开发天气应用

    简介:本节课我们会制作一款天气应用,这款应用允许用户查看当前的天气情况.天气预报以及地点收藏,在模态框内显示日出和日落的数据,使用分页滚动面板显示天气信息,使用侧滑菜单实现导航. 6.1 项目配置 环 ...

  5. BZOJ 3550 ONTAK2010 Vacation 单纯形

    题目大意:给定一个长度为3n的区间.要求选一些数,且随意一段长度为n的区间内最多选k个数.求选择数的和的最大值 单纯形直接搞 注意一个数仅仅能被选一次 因此要加上xi<=1这个约束条件 不明确3 ...

  6. SQLServer删除数据库

    删除时提示: 网上找了一段: USE MASTER GO DECLARE @dbname SYSNAME SET @dbname = 'shujk' --这个是要删除的数据库库名 ) DECLARE ...

  7. IDE配置jvm参数

    -------- IntelliJ IDEA 配置参数:-Xms34m -Xmx234m 内存初始化大小,最小和最大值: 测试代码: public class JVMDemoTest { public ...

  8. tcp与socket关系

    套接字(socket)是通信的基石,是支持TCP/IP协议的网络通信的基本操作单元.

  9. 编译Android VNC Server【转】

    本文转载自:http://www.cnblogs.com/fengfeng/p/3289292.html 1,在如下地址checkout源代码,我checkout的版本为0.9.7http://cod ...

  10. Jquery与Dom对象相互转化

    Jquery与Dom对象相互转化   jQurey对象和DOM对象的相互转换 在讨论jQurey对象和DOM对象的相互转换之前,我们先约定定义变量的风格.如果我们获取的对象是jQuery对象,那么我们 ...