結果
問題 | No.2510 Six Cube Sum Counting |
ユーザー | ゼット |
提出日時 | 2023-10-23 18:50:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,888 ms / 4,000 ms |
コード長 | 715 bytes |
コンパイル時間 | 967 ms |
コンパイル使用メモリ | 82,032 KB |
実行使用メモリ | 292,116 KB |
最終ジャッジ日時 | 2024-09-22 12:37:50 |
合計ジャッジ時間 | 50,316 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
L=[] N=int(input()) A=set() for d in range(0,301): for e in range(d,301): for f in range(e,301): u=d**3+e**3+f**3 if u>N: continue A.add(u) for d in range(0,301): for e in range(d,301): for f in range(e,301): u=d**3+e**3+f**3 x=N-u if not x in A: continue L.append(1000*u+d) L.sort() from bisect import bisect_right result=0 L.sort() if len(L)==0: print(0) exit() z=L[-1] for a in range(0,301): for b in range(a,301): for c in range(b,301): x=N-(a**3+b**3+c**3) if not x in A: continue u=x*1000+c pos1=bisect_right(L,x*1000+400) pos2=bisect_right(L,u-1) result+=pos1-pos2 print(result)