JOI2006模擬試験1 問題1@Python(-48)
bとcの大小検査しなくてよかったことに今頃気づいた。
#!/usr/bin/python # -*- coding: utf-8 -*- count_all = 0 count_right = 0 count_less = 0 count_more = 0 while True: a, b, c = [int(x) for x in raw_input().split(' ')] if(a < b): a, b = b, a if(a < c): a, c = c, a if(a >= b + c): break count_all += 1 d = a * a - b * b - c * c if(d > 0): count_more += 1 elif(d == 0): count_right += 1 else: count_less += 1 print "%d %d %d %d" % (count_all, count_right, count_less, count_more)