ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๐Ÿ‘ฉ๐Ÿป‍๐Ÿ’ป ๋ฌธ์ œ

 

5543๋ฒˆ: ์ƒ๊ทผ๋‚ ๋“œ

๋ฌธ์ œ ์ƒ๊ทผ๋‚ ๋“œ์—์„œ ๊ฐ€์žฅ ์ž˜ ํŒ”๋ฆฌ๋Š” ๋ฉ”๋‰ด๋Š” ์„ธํŠธ ๋ฉ”๋‰ด์ด๋‹ค. ์ฃผ๋ฌธํ•  ๋•Œ, ์ž์‹ ์ด ์›ํ•˜๋Š” ํ–„๋ฒ„๊ฑฐ์™€ ์Œ๋ฃŒ๋ฅผ ํ•˜๋‚˜์”ฉ ๊ณจ๋ผ, ์„ธํŠธ๋กœ ๊ตฌ๋งคํ•˜๋ฉด, ๊ฐ€๊ฒฉ์˜ ํ•ฉ๊ณ„์—์„œ 50์›์„ ๋บ€ ๊ฐ€๊ฒฉ์ด ์„ธํŠธ ๋ฉ”๋‰ด์˜ ๊ฐ€๊ฒฉ์ด ๋œ๋‹ค. ํ–„๋ฒ„๊ฑฐ๋Š” ์ด 3์ข…๋ฅ˜ ์ƒ๋•๋ฒ„๊ฑฐ, ์ค‘๋•๋ฒ„๊ฑฐ, ํ•˜๋•๋ฒ„๊ฑฐ๊ฐ€ ์žˆ๊ณ , ์Œ๋ฃŒ๋Š” ์ฝœ๋ผ์™€ ์‚ฌ์ด๋‹ค ๋‘ ์ข…๋ฅ˜๊ฐ€ ์žˆ๋‹ค. ํ–„๋ฒ„๊ฑฐ์™€ ์Œ๋ฃŒ์˜ ๊ฐ€๊ฒฉ์ด ์ฃผ์–ด์กŒ์„ ๋•Œ, ๊ฐ€์žฅ ์‹ผ ์„ธํŠธ ๋ฉ”๋‰ด์˜ ๊ฐ€๊ฒฉ์„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์ž…๋ ฅ ์ž…๋ ฅ์€ ์ด ๋‹ค์„ฏ ์ค„์ด๋‹ค. ์ฒซ์งธ ์ค„์—๋Š” ์ƒ๋•๋ฒ„๊ฑฐ, ๋‘˜์งธ ์ค„์—๋Š”

www.acmicpc.net


โœ๐Ÿป ํ’€์ด

๐ŸŽจ Go

package main

import (
	"fmt"
)

func main() {
	burgers := make([]int, 3)
	for i := range burgers {
		fmt.Scanf("%d", &burgers[i])
	}

	beverages := make([]int, 2)
	for i := range beverages {
		fmt.Scanf("%d", &beverages[i])
	}

	var minBurger, minBeverage = 2000, 2000
	for _, burger := range burgers {
		if burger < minBurger {
			minBurger = burger
		}
	}
	for _, beverage := range beverages {
		if beverage < minBeverage {
			minBeverage = beverage
		}
	}
	fmt.Println(minBurger + minBeverage - 50)
}

๐ŸŽจ Python3

import sys

min_burger, min_beverage = 2000, 2000

for i in range(3):
    price = int(sys.stdin.readline())
    if price < min_burger:
        min_burger = price

for i in range(2):
    price = int(sys.stdin.readline())
    if price < min_beverage:
        min_beverage = price
        
print(min_burger + min_beverage - 50)
728x90
๋Œ“๊ธ€