zoukankan      html  css  js  c++  java
  • 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem C. Contest 水题

    Problem C. Contest

    题目连接:

    http://codeforces.com/gym/100714

    Description

    The second round of the annual student collegiate programming contest is being held in city N. To
    be prepared for the inrush of participants, the jury needs to know the number of them attending the
    previous, first round.
    Unfortunately, the statistics regarding that first round (including the final standings) was lost during a
    recent disk failure and no backup was made.
    The only hope is a short statistical summary that was found written on a tiny piece of paper by the oldest
    jury member. The percentage of teams which have solved the problem is provided for each problem of
    the the first round. Each percentage is an integer rounded using the usual mathematical rules (numbers
    with a fractional part strictly less than .5 are rounded down, the others are rounded up).
    This is the only information the jury has at hand. Also, that oldest jury member clearly remembers that
    a prize was awarded to some team during the first round, probably for winning it. Hence, at least one
    team had participated in the first round.

    Input

    The first line of input contains an integer N (3 ≤ N ≤ 12) — the total number of problems in the
    contest. The second line of input contains N integers P1, . . . , PN . Each number Pi (0 ≤ Pi ≤ 100)
    denotes a percentage of the teams solved the i
    th problem.

    Output

    Print out the minimum possible number of teams that could have participated in the first round.

    Sample Input

    3
    33 67 100

    Sample Output

    3

    Hint

    题意

    告诉你每道题的过题率,但是都是四舍五入了的。

    请你输出最少有多少个队伍参加,才能满足这个过题率。

    至少为1个队

    题解:

    数据范围很小嘛,就暴力枚举人数就好了。

    代码

    #include <bits/stdc++.h>
    
    using namespace std;
    
    int v[110][110],a[110],n;
    
    int main()
    {
        //freopen("out.txt","w",stdout);
        for(int i=1;i<=100;i++)
        {
            v[i][0]=1;
            for(int j=1;j<=i;j++)
            {
                double x=j/((double)1.0*i)*(double)100.0;
                int y=(int)(x+(double)0.5000000000001);
                v[i][y]=1;
            }
        }
       /* for(int i = 1 ; i <= 100 ; ++ i){
            for(int j = 1 ; j <= i ; ++ j) printf("%d,%d,%d
    " , i , j , v[i][j]);
        }*/
        scanf("%d",&n);
        for(int i=1;i<=n;i++) scanf("%d",&a[i]);
        for(int i=1;i<=100;i++)
        {
            int flag=1;
            for(int j=1;j<=n;j++)
                if(!v[i][a[j]])
                {
                    flag=0;
                    break;
                }
            if(flag)
            {
                printf("%d
    ",i);
                return 0;
            }
        }
        return 0;
    }
  • 相关阅读:
    C/C++程序员必备的15个编辑器和集成开发环境
    天猫浏览型应用的CDN静态化架构演变
    实用技巧:如何用 CSS 做到完全垂直居中
    JavaScript 字符串操作:substring, substr, slice
    Hybrid App 开发初探:使用 WebView 装载页面
    引领潮流!最顶尖的24个获奖网页作品
    HTML5编程之旅系列一:HTML5 Geolocation 初探
    JavaScript 秘密花园——对象的使用和属性操作
    提高效率!15款最好的 Bug 跟踪应用程序
    最常用的8款 PHP 调试工具,你用过吗?
  • 原文地址:https://www.cnblogs.com/qscqesze/p/5750724.html
Copyright © 2011-2022 走看看