zoukankan      html  css  js  c++  java
  • Codeforces Gym101502 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 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

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

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

    最后放一张图:

    溜了溜了(*/ω\*)

  • 相关阅读:
    C# 生成 DataMatrix 格式的二维码
    Matlab如何连接Oracle数据库及基本操作
    Matlab调用返回游标的存储过程的分析和处理
    Matlab 调用Oracle数据库
    安装discourse
    设置HttponlyCookie解决mshtml编程无法获取验证码图片流
    C#通过COM组件操作IE浏览器(四):实用代码总结
    C#通过COM组件操作IE浏览器(三):了解IHTMLDocument2
    C#通过COM组件操作IE浏览器(二):使用IHTMLDocument3完成登录
    C#通过COM组件操作IE浏览器(一):打开浏览器跳转到指定网站
  • 原文地址:https://www.cnblogs.com/ZERO-/p/9703331.html
Copyright © 2011-2022 走看看