2017 JUST Programming Contest 3.0 K. Malek and Summer Semester
1.0 s
256 MB
standard input
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.
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.
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).
2
5 0.60
45 46 48 48 50
5 0.75
100 99 98 97 100
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的更多相关文章
- 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 ...
- 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 ...
- 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_{ ...
- gym101532 2017 JUST Programming Contest 4.0
台州学院ICPC赛前训练5 人生第一次ak,而且ak得还蛮快的,感谢队友带我飞 A 直接用claris的模板啊,他模板确实比较强大,其实就是因为更新的很快 #include<bits/stdc+ ...
- gym101343 2017 JUST Programming Contest 2.0
A.On The Way to Lucky Plaza (数论)题意:m个店 每个店可以买一个小球的概率为p 求恰好在第m个店买到k个小球的概率 题解:求在前m-1个店买k-1个球再*p ...
- 2017 JUST Programming Contest 2.0
B. So You Think You Can Count? 设dp[i]表示以i为结尾的方案数,每个位置最多往前扫10位 #include<bits/stdc++.h> using na ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- 如何使用shell收集linux系统状态,并把结果发给远端服务器
第一步:收集系统当天状态 load状态 内存状态 cpu状态 jvm相关信息:jstat jstack 网络信息 硬盘信息 第二步:发送到远端服务器 使用curl.wget.定义接口. https:/ ...
- 基于Hexo + Git + Nginx的博客发布
进过上一篇<树莓派搭建私人服务器>,我们已经有一个私人服务器了,现在需要做点什么实际事情了,先搭一个博客分享自己的经验吧. 相关文章:1.<树莓派搭建私人服务器>(http:/ ...
- QT窗体间传值总结之Signal&Slot
在写程序时,难免会碰到多窗体之间进行传值的问题.依照自己的理解,我把多窗体传值的可以使用的方法归纳如下: 1.使用QT中的Signal&Slot机制进行传值: 2.使用全局变量: 3.使用pu ...
- dhcp 过程
The Question SuperUser reader Sagnik Sarkar wants to know what the difference between 127.0.0.1 and ...
- Android点击Button水波纹效果
先上图,看看接下来我要向大家介绍的是个什么东西,例如以下图: 接下来要介绍的就是怎样实现上述图中的波纹效果.这样的效果假设大家没有体验过的话,能够看看百度手机卫士或者360手机卫士,里面的按钮点击效果 ...
- [Rust] Setup Rust for WebAssembly
In order to setup a project we need to install the nightly build of Rust and add the WebAssembly tar ...
- Java静态分派与动态分派(二)
方法调用并不等于方法执行,方法调用阶段唯一的任务就是确定被调用方法的版本(即调用哪一个方法),暂时还不涉及方法内部的具体运行过程. 在程序运行时,进行方法调用是最普遍.最频繁的操作,但是Class文件 ...
- LoadRunner压测时,出现的问题汇总
[问题]Error -10776 Failed to find .cfg file 错误分析:在loadrunner打开脚本的情况下,运行磁盘清理工具,导致运行打开的脚本时,提示Mdrv error ...
- 说说Windows7 64bits下安装TensorFlow GPU版本会遇到的一些坑
不多说,直接上干货! 再写博文,回顾在Windows7上安装TensorFlow-GPU的一路坑 Windows7上安装TensorFlow的GPU版本后记 欢迎大家,加入我的微信公众号:大数据躺过的 ...
- Android 通过ADB Wireless无线调试应用
使用数据线调试应用难免不方便,本篇博客介绍使用ADB Wireless工具.当手机和电脑处在同一网络下.实现无线调试应用. ADB Wireless可以让手机用无线来代替USB连接.而使用ADB工具的 ...