結果
| 問題 |
No.653 E869120 and Lucky Numbers
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 00:14:05 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 848 bytes |
| コンパイル時間 | 228 ms |
| コンパイル使用メモリ | 82,532 KB |
| 実行使用メモリ | 53,656 KB |
| 最終ジャッジ日時 | 2025-04-16 00:15:22 |
| 合計ジャッジ時間 | 2,443 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 6 |
ソースコード
p = input().strip()
if not p.startswith('1'):
print("No")
else:
if len(p) == 1:
print("No")
else:
s = p[1:]
reversed_s = s[::-1]
current_carries = {0}
for c in reversed_s:
current_digit = int(c)
new_carries = set()
for carry_in in current_carries:
for a in [6, 7]:
for b in [6, 7]:
total = a + b + carry_in
mod = total % 10
if mod == current_digit:
carry_out = total // 10
new_carries.add(carry_out)
current_carries = new_carries
if not current_carries:
break
if 1 in current_carries:
print("Yes")
else:
print("No")
lam6er