JOI2006模擬試験1 問題1@Java(-47)
200記事いけなくなりそうなので、記事稼ぎ。
import java.io.*; import static java.lang.Integer.parseInt; public class t1 { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int count_all=0; int count_right=0; int count_less=0; int count_more=0; while(true) { String[] line_split=in.readLine().split(" "); int a=parseInt(line_split[0]); int b=parseInt(line_split[1]); int c=parseInt(line_split[2]); if(a<b) {int t=a;a=b;b=t;} if(b<c) {int t=b;b=c;c=t;} if(a<b) {int t=a;a=b;b=t;} if(a>=b+c) break; count_all++; int d=a*a-b*b-c*c; if(d>0) { count_more++; } else if(d==0) { count_right++; } else { count_less++; } } System.out.println(count_all+" "+count_right+" "+count_less+" "+count_more); } }