HDOJ 2008 Java

水题,逻辑清晰的都是水题 

import java.util.Scanner;
public class Main {
    public static void main(String args[]) {
        Scanner sr=new Scanner(System.in);
        while(sr.hasNext()) {
            int n = sr.nextInt();
            if(n == 0){
                continue;
            }
            int zero = 0;
            int posnumber = 0;
            int negnumber = 0;
            for(int i = 0; i < n; i++){
                double num = sr.nextDouble();
                if(num > 0.0){
                    posnumber++;
                }else if(num == 0){
                    zero++;
                }else{
                    negnumber++;
                }
            }
            System.out.println(negnumber + " " + zero + " " + posnumber);
        }
    }
}

 

上一篇:Windows Server 2008 安装 SQL Server 2008 报错:试图执行未经授权的操作


下一篇:C++/智能指针/shared_ptr/unique_ptr/weak_ptr/auto_ptr