From 4703e305f073387511eb2018229a1e3914b31ac9 Mon Sep 17 00:00:00 2001 From: Gyubin Han <89185979+Gyubin-Han@users.noreply.github.com> Date: Tue, 7 May 2024 17:15:41 +0900 Subject: [PATCH] add: boj/1541.py --- boj/1541.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 boj/1541.py diff --git a/boj/1541.py b/boj/1541.py new file mode 100644 index 0000000..06f562e --- /dev/null +++ b/boj/1541.py @@ -0,0 +1,17 @@ +s=input() + +smarr=s.split("-") +front=True +result=0 + +for i in smarr: + p=0 + for j in i.split("+"): + p+=int(j) + if front: + result+=p + front=False + else: + result-=p + +print(result) \ No newline at end of file