結果
| 問題 |
No.1243 約数加算
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-03-21 18:51:51 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,413 bytes |
| コンパイル時間 | 91 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-09-18 14:26:42 |
| 合計ジャッジ時間 | 9,718 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 4 OLE * 3 |
ソースコード
T = int(input())
for _ in range(T):
A, B = map(int, input().split())
ans = []
nokori = 120
flag = 1
while A != B and flag:
while 2 * A <= B:
ans.append(A)
A *= 2
nokori -= 1
if B - A <= nokori:
ans.extend([1] * (B - A))
break
ind = 0
while A <= B:
print(A, B, ans, sum(ans))
two = 2 ** ind
for i in range(ind + 1):
if (B - A)//(2**i) <= nokori and (B - A)%(2**i)==0:
ans.extend([2**i] * ((B - A)//(2**i) ))
A += sum([2**i] * ((B - A)//(2**i) ))
break
if A % two == 0:
if A + A // two <= B:
ans.append(A // two)
A += A // two
nokori -= 1
ind = 0
break
else:
ind += 1
else:
if A + two // 2 > B:
flag = 0
break
A += two // 2
nokori -= 1
ans.append(two // 2)
cnt = 0
for i in range(60):
if ((B - A) >> i) & 1:
ans.append(1 << i)
cnt += 1 << i
print(len(ans))
print(*ans)
rlangevin