HDOJ2061Treasure the new start, freshmen!

来源:互联网 发布:sql语句select from 编辑:程序博客网 时间:2024/06/05 19:46

HDACM2061

import java.util.Scanner;class Main{    public static void main(String args[]){        Scanner sc = new Scanner(System.in);        int n = sc.nextInt();        while(n-->0){            int m = sc.nextInt();            double ssum =0;            double csum =0;            boolean boo = true;            while(m-->0){                String str = sc.next();                double c = sc.nextDouble();                double s = sc.nextDouble();                if (s<60&&s>=0) {                    boo = false;                }                csum += c;                ssum += s*c;            }            if (boo) {                System.out.printf("%.2f",ssum/csum);                System.out.println();            }else {                System.out.println("Sorry!");            }            if (n>0) {                System.out.println();            }        }    }}
原创粉丝点击