ํฐ์คํ ๋ฆฌ ๋ทฐ
๐ฉ๐ป๐ป ๋ฌธ์
โ๐ป ํ์ด
๐จ Go
// https://www.acmicpc.net/problem/14697v
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
var a, b, c, n int
fmt.Fscanln(reader, &a, &b, &c, &n)
fmt.Fprintln(writer, checkRooms(a, b, c, n))
}
func checkRooms(a, b, c int, n int) int {
for i := 0; i <= n; i++ {
for j := 0; j <= n-i; j++ {
for k := 0; k <= n-i-j; k++ {
if a*i+b*j+c*k == n {
return 1
}
}
}
}
return 0
}
๐จ Python3
# https://www.acmicpc.net/problem/14697
import sys
def check_rooms(a, b, c, n):
for i in range(0, n+1):
for j in range(0, n+1-i):
for k in range(0, n+1-i-j):
if a*i + b*j + c*k == n:
return 1
return 0
if __name__ == "__main__":
a, b, c, n = list(map(int, sys.stdin.readline().split()))
print(check_rooms(a, b, c, n))
728x90
'dev > algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
BOJ / 13301๋ฒ / ํ์ผ ์ฅ์๋ฌผ [Go][Python3] (0) | 2021.01.18 |
---|---|
BOJ / 9625๋ฒ / BABBA [Go][Python3] (0) | 2021.01.17 |
BOJ / 2309๋ฒ / ์ผ๊ณฑ ๋์์ด [Go][Python3] (0) | 2021.01.15 |
BOJ / 14501๋ฒ / ํด์ฌ [Go][Python3] (0) | 2021.01.14 |
BOJ / 11727๋ฒ / 2รn ํ์ผ๋ง 2 [Go][Python3] (0) | 2021.01.13 |
๋๊ธ
๊ธ ๋ณด๊ดํจ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
TAG
- ๋ฐ๋
- ์๋ฐ
- BFS
- ๋ชฝ๊ณ ๋๋น
- ์คํ
- go
- Algorithm
- ๋ฐฑ์ค
- Macbook pro 2012 mid 13
- ํด์๋งต
- dfs
- ํ๋ก์ด๋์์ฌ
- ๋งฅ๋ถ ์ ๊ทธ๋ ์ด๋
- ํ
- ballet
- ๋ถํ ์ ๋ณต
- AWS
- MongoDB
- java
- Golang
- baekjoon
- ๋งฅ๋ถ
- ์ด๋ถํ์
- ๋งฅ๋ถํ๋ก
- dp
- BOJ
- python3
- ์๊ณ ๋ฆฌ์ฆ
- ์๊ฐ๊ต์ฒด
- ๋ธ๋ฃจํธํฌ์ค
- Total
- Today
- Yesterday