PKU 2656 "Unhappy Jinjin"

問題:http://acm.pku.edu.cn/JudgeOnline/problem?id=2656
順位:http://acm.pku.edu.cn/JudgeOnline/problemstatus?problem_id=2656&orderby=clen&language=2
提出コード(201B)

import java.util.*;class Main{static{int n,t,i,j,m;for(Scanner s=new Scanner(System.in);(n=s.nextInt())>0;){for(m=i=j=0;i++<n;)if((t=s.nextInt()+s.nextInt())>m){m=t;j=i;}System.out.println(m>8?j:0);}}}

整形コード

class Main {
	static {
		int n, t, i, j, m;
		for (Scanner s = new Scanner(System.in); (n = s.nextInt()) > 0;) {
			for (m = i = j = 0; i++ < n;)
				if ((t = s.nextInt() + s.nextInt()) > m) {
					m = t;
					j = i;
				}
			System.out.println(m > 8 ? j : 0);
		}
	}
}