[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ์์ ๋ํ๊ธฐ / Python
๐ Problem Solving/Programmers
import sys
input = sys.stdin.readline
absolutes = list(map(int, input().split()))
signs = list(map(int, input().split()))
def solution(absolutes, signs):
for i in range(len(signs)):
if signs[i] == False:
absolutes[i] *= -1
return sum(absolutes)
print(solution(absolutes, signs))
ํด์ค
signs์ false์ธ ๊ฒฝ์ฐ์๋ง absolutes ํด๋น ์ธ๋ฑ์ค ๊ฐ์ ์์๋ก ์ทจํด์ค๋ค.
์ฒ์์ ์ ์ถ๋ ฅ ์๋ฅผ ๋ณด๊ณ "true", "false"๋ก ์ ๋ ฅ์ด ๋๋ ์ค ์์๋๋ฐ boolean์ธ True, False๋ก ์ ๋ ฅ์ ๋ฐ์์ผํ๋ค..
'๐ Problem Solving > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ์คํจ์จ / Python (0) | 2021.06.01 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ํคํจ๋ ๋๋ฅด๊ธฐ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ๋ก๋์ ์ต๊ณ ์์์ ์ต์ ์์ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ์์ ๋ง๋ค๊ธฐ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ํฐ์ผ๋ชฌ / Python (0) | 2021.06.01 |