結果
| 問題 | No.3332 Consecutive Power Sum (Small) |
| コンテスト | |
| ユーザー |
ゼット
|
| 提出日時 | 2025-11-02 21:34:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 833 ms / 2,025 ms |
| コード長 | 691 bytes |
| 記録 | |
| コンパイル時間 | 434 ms |
| コンパイル使用メモリ | 82,708 KB |
| 実行使用メモリ | 150,988 KB |
| 最終ジャッジ日時 | 2025-11-02 21:36:07 |
| 合計ジャッジ時間 | 24,087 ms |
|
ジャッジサーバーID (参考情報) |
judge7 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 52 |
ソースコード
N=int(input())
result=[]
for d in range(1,10**7):
if (d*(d+1)//2)>N:
break
l=1
r=N
while True:
if l==r:
break
m=(l+r)//2
s=d*((m+m+d-1))//2
if s>=N:
r=m
else:
l=m+1
if d*((l+l+d-1))//2==N:
result.append((1,l,l+d-1))
from bisect import bisect_right
for E in range(2,50):
h=[]
c=0
for x in range(1,10**6+1):
c+=x**E
h.append(c)
if x**E>N:
break
c=0
for x in range(1,10**6+1):
y=c+N
pos=bisect_right(h,y)
if h[pos-1]==y:
result.append((E,x,pos))
if x**E>N:
break
c+=x**E
result.sort()
print(len(result))
for i in range(len(result)):
a,b,c=result[i][:]
print(a,b,c)
ゼット