結果

問題 No.152 貯金箱の消失
ユーザー ktshunktshun
提出日時 2015-06-10 20:50:10
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,811 ms / 5,000 ms
コード長 431 bytes
コンパイル時間 794 ms
コンパイル使用メモリ 6,692 KB
実行使用メモリ 6,248 KB
最終ジャッジ日時 2023-09-20 20:37:03
合計ジャッジ時間 6,881 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,096 KB
testcase_01 AC 12 ms
6,176 KB
testcase_02 AC 12 ms
6,020 KB
testcase_03 AC 13 ms
6,024 KB
testcase_04 AC 29 ms
6,028 KB
testcase_05 AC 31 ms
6,096 KB
testcase_06 AC 47 ms
6,172 KB
testcase_07 AC 268 ms
6,160 KB
testcase_08 AC 1,769 ms
6,188 KB
testcase_09 AC 1,811 ms
6,020 KB
testcase_10 AC 1,370 ms
6,216 KB
testcase_11 AC 757 ms
6,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding:utf-8 -*-
import math

def euclidean(n,m):
	while 1:
		if max(n,m) % min(n,m) == 0:
			return min(n,m)
		if n > m:
			n = n % m
		else:
			m = m % n

if __name__ == "__main__":
	l = input()
	l = l / 4
	ans = 0
	for i in xrange(1,int(math.sqrt(l))):
		for j in xrange(1,i):
			if (i-j) % 2 != 1:
				continue
			elif euclidean(i,j) != 1:
				continue
			else:
				if 2 * i **2 + 2 * i * j <= l:
					ans += 1
	print ans
0