結果
| 問題 |
No.2086 A+B問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-24 20:40:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 531 bytes |
| コンパイル時間 | 532 ms |
| コンパイル使用メモリ | 82,448 KB |
| 実行使用メモリ | 54,372 KB |
| 最終ジャッジ日時 | 2024-07-24 20:40:33 |
| 合計ジャッジ時間 | 2,163 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 WA * 1 |
ソースコード
A = input()
B = input()
N = max(len(A), len(B))+1
A = str(A).zfill(N)
B = str(B).zfill(N)
A = A[::-1]
B = B[::-1]
# print(A)
if A == "0" and B == "0":
print("0")
exit()
ans = []
kuri = 0
for i in range(N):
now = int(A[i]) + int(B[i]) + kuri
if now >= 10:
kuri = 1
else:
kuri = 0
ans.append(str(now%10))
sans_ = "".join(ans)
sans_ = sans_[::-1]
ans = []
first = True
for c in sans_:
if first == True and c == '0':
continue
first = False
ans.append(c)
print("".join(ans))