結果
問題 | No.2086 A+B問題 |
ユーザー |
|
提出日時 | 2024-07-24 20:41:05 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 531 bytes |
コンパイル時間 | 267 ms |
コンパイル使用メモリ | 82,788 KB |
実行使用メモリ | 53,872 KB |
最終ジャッジ日時 | 2024-07-24 20:41:08 |
合計ジャッジ時間 | 2,257 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
A = input() B = input() N = max(len(A), len(B))+1 if A == "0" and B == "0": print("0") exit() A = str(A).zfill(N) B = str(B).zfill(N) A = A[::-1] B = B[::-1] # print(A) 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))