HDOJ 2061 Treasure the new start, freshmen!


题目地址:
http://acm.hdu.edu.cn/showproblem.php?pid=2061


看见题目太长了,听MiYu大神说是水题,就直接COPY他的代码了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
#include <iostream>
using namespace std;
int main ()
{
    int f, T, N;
    double s, c;
    double up, down; 
    scanf( "%d", &T );
    while ( T -- )
    {
            scanf ( "%d", &N );
            up = down = f = 0;
            while ( N -- )
            {
                  scanf ( "%*s%lf%lf", &c, &s );
                  if ( f )
                  {
                       continue;
                  }
                  if ( s < 60 && s >= 0 )
                  {
                       f = 1;
                  }
                  up += s * c;
                  down += c;
            }
            printf( f ? "Sorry!\n" : "%.2f\n", up / down );
            if ( T ) putchar ( '\n' );
    }
    return 0;
}

发布者

Tanky Woo

Tanky Woo,[个人主页:https://tankywoo.com] / [新博客:https://blog.tankywoo.com]

《HDOJ 2061 Treasure the new start, freshmen!》有492个想法

发表评论

电子邮件地址不会被公开。 必填项已用*标注