2020 cattle off winter training camp algorithm base 5 I sign problem

https://ac.nowcoder.com/acm/contest/3006/I

Title Description

After 2019 a year of game, beef clan members discovered a major rule: I check in question is a question!

Check-defined question is: by number greater than or equal to 80% of the number of audience or by the number of all the problems currently more than three questions (that is, up to two questions more than it strictly by the number of people) called the attendance problem.

2020 season is coming, beef clan going to test this law, and is now known through the circumstances of each title question, I look at the title is not a sign problem.

Thinking 

The first question I is the ninth title, the title has said the number of items than or equal to 9. This is a true sign, two marks, initially false, if the number is greater than I by a title equal to 80% of the total, f1 = true, then sort by the number of questions if I is greater than equal to the third number of large, f2 = true If f1 || f2 == true output yes

/*************************************************************************
    > File Name: I.cpp
    > Author: amoscykl
    > Mail: [email protected]
    > Created Time: 2020年02月13日 星期四 13时35分02秒
 ************************************************************************/
 
#include<bits/stdc++.h>
using namespace std;
int n, m;
int a[20];
int main()
{
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; i++){
        scanf("%d", a + i);
    }
    int I = a[9];
    bool f = 0;
    if (I * 1.0 >= 0.8 * m)f = 1;
    sort(a + 1, a + 1 + n);
    if (I >= a[n - 2])f = 1;
    printf(f ? "yes" : "no");
    return 0;
}

 

Published 204 original articles · won praise 13 · views 10000 +

Guess you like

Origin blog.csdn.net/weixin_43701790/article/details/104308306