Trang

Chủ Nhật, 2 tháng 1, 2011

3456. Rank

import java.io.*;

public class Main {

    /**
     * http://acm.tju.edu.cn/toj/showp3456.html
     * @author hunglee
     */
    public static void main(String[] args) throws IOException {
        
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(
                new InputStreamReader(System.in)));
        
        int n, a[];
        in.nextToken();
        n = (int) in.nval;
        a = new int[n];
        for (int i = 0; i < n; ++i) {
            in.nextToken();
            a[i] = (int) in.nval;
        }
        int res = 0;
        for (int i = 1; i < n; ++i)
            if (a[i] > a[0])
                ++res;
        System.out.println(res + 1);
    }

}

Không có nhận xét nào:

Đăng nhận xét