結果
問題 | No.800 四平方定理 |
ユーザー | pasoconhoshii |
提出日時 | 2019-03-17 23:14:41 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 812 bytes |
コンパイル時間 | 192 ms |
コンパイル使用メモリ | 10,928 KB |
実行使用メモリ | 16,376 KB |
最終ジャッジ日時 | 2023-09-22 10:20:42 |
合計ジャッジ時間 | 16,267 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 788 ms
16,376 KB |
testcase_01 | AC | 1,725 ms
7,796 KB |
testcase_02 | AC | 1,140 ms
7,740 KB |
testcase_03 | AC | 1,258 ms
7,792 KB |
testcase_04 | AC | 901 ms
7,824 KB |
testcase_05 | AC | 1,113 ms
7,796 KB |
testcase_06 | TLE | - |
testcase_07 | AC | 1,811 ms
7,956 KB |
testcase_08 | TLE | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
N,D = map(int, input().split()) lst = [i**2 for i in range(1, N+1)] ans= 0 for i in range(N): x = lst[i] for j in range(N): y = lst[j] s = x+y-D if s == 0: ans += N else: # $BLs?t%j%9%H(B divlst = [] s = abs(s) for div in range(1, int(s**0.5)+1): if s % div == 0: divlst.append( div ) # print("divlst: ", divlst) for a in divlst: b = s // a if a <= b: if ( a + b ) % 2 == 0: w = (a+b)//2 v = (b-a)//2 if 1 <= w <= N and 1 <= v <= N: ans += 1 print(ans)