結果

問題 No.2510 Six Cube Sum Counting
ユーザー ゼットゼット
提出日時 2023-10-23 18:50:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,066 ms / 4,000 ms
コード長 715 bytes
コンパイル時間 1,563 ms
コンパイル使用メモリ 81,776 KB
実行使用メモリ 291,652 KB
最終ジャッジ日時 2023-10-23 18:51:18
合計ジャッジ時間 55,786 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 288 ms
75,440 KB
testcase_01 AC 266 ms
75,444 KB
testcase_02 AC 2,863 ms
281,004 KB
testcase_03 AC 187 ms
70,348 KB
testcase_04 AC 219 ms
75,456 KB
testcase_05 AC 234 ms
75,452 KB
testcase_06 AC 2,310 ms
266,320 KB
testcase_07 AC 2,308 ms
266,320 KB
testcase_08 AC 2,348 ms
266,324 KB
testcase_09 AC 1,647 ms
266,320 KB
testcase_10 AC 1,633 ms
266,320 KB
testcase_11 AC 2,259 ms
266,320 KB
testcase_12 AC 2,268 ms
266,320 KB
testcase_13 AC 2,247 ms
266,324 KB
testcase_14 AC 2,298 ms
266,324 KB
testcase_15 AC 247 ms
70,340 KB
testcase_16 AC 177 ms
70,348 KB
testcase_17 AC 150 ms
70,340 KB
testcase_18 AC 1,686 ms
266,324 KB
testcase_19 AC 1,658 ms
266,320 KB
testcase_20 AC 2,513 ms
254,468 KB
testcase_21 AC 2,875 ms
281,920 KB
testcase_22 AC 3,066 ms
270,324 KB
testcase_23 AC 2,525 ms
255,336 KB
testcase_24 AC 2,866 ms
282,000 KB
testcase_25 AC 2,263 ms
266,320 KB
testcase_26 AC 2,319 ms
266,320 KB
testcase_27 AC 2,509 ms
291,652 KB
testcase_28 AC 1,625 ms
266,320 KB
testcase_29 AC 2,902 ms
279,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0