結果
問題 | No.152 貯金箱の消失 |
ユーザー | nbisco |
提出日時 | 2017-01-29 09:47:46 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 642 ms / 5,000 ms |
コード長 | 342 bytes |
コンパイル時間 | 478 ms |
コンパイル使用メモリ | 10,552 KB |
実行使用メモリ | 9,812 KB |
最終ジャッジ日時 | 2023-10-11 02:47:37 |
合計ジャッジ時間 | 3,877 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
9,796 KB |
testcase_01 | AC | 31 ms
9,780 KB |
testcase_02 | AC | 29 ms
9,636 KB |
testcase_03 | AC | 30 ms
9,640 KB |
testcase_04 | AC | 37 ms
9,776 KB |
testcase_05 | AC | 38 ms
9,780 KB |
testcase_06 | AC | 44 ms
9,640 KB |
testcase_07 | AC | 126 ms
9,616 KB |
testcase_08 | AC | 642 ms
9,812 KB |
testcase_09 | AC | 629 ms
9,612 KB |
testcase_10 | AC | 501 ms
9,620 KB |
testcase_11 | AC | 297 ms
9,772 KB |
ソースコード
import math import fractions L = int(input()) mod = 1000003 count = 0 for x in range(2, int(math.sqrt(L//4))+1): for y in range(1, x): if (x-y) % 2 == 0: continue a = x**2 - y**2 b = 2*x*y c = x**2 + y**2 if (a+b+c)*4 <= L and math.gcd(x,y) == 1: count += 1 print(count%mod)