結果
| 問題 |
No.49 算数の宿題
|
| コンテスト | |
| ユーザー |
cherrypi59
|
| 提出日時 | 2018-10-02 22:44:33 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 5,000 ms |
| コード長 | 479 bytes |
| コンパイル時間 | 319 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-12-23 02:00:19 |
| 合計ジャッジ時間 | 1,177 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
def main():
s = input()
idx = 0
while idx < len(s) and s[idx].isdigit():
idx += 1
res = int(s[:idx])
for i in range(len(s)):
if not s[i].isdigit():
idx = i+1
while idx < len(s) and s[idx].isdigit():
idx += 1
if s[i] == "+":
res *= int(s[i+1:idx])
elif s[i] == "*":
res += int(s[i+1:idx])
print(res)
if __name__ == '__main__':
main()
cherrypi59