From bc7946498406be13c6e46b1d2fb9bd80dc4e55bd Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 31 Dec 2023 01:36:34 +0900 Subject: [PATCH] Update 2023.12.31 --- Silver_I/1527.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Silver_I/1527.py diff --git a/Silver_I/1527.py b/Silver_I/1527.py new file mode 100644 index 0000000..d342e62 --- /dev/null +++ b/Silver_I/1527.py @@ -0,0 +1,23 @@ +# 금민수의 개수 + +def count_gumminsu(A, B): + def generate_gumminsu(n): + # 금민수를 생성하는 함수 + if n > B: + return 0 + count = 0 + if n >= A: + count += 1 + count += generate_gumminsu(n * 10 + 4) # 4를 추가한 경우 + count += generate_gumminsu(n * 10 + 7) # 7을 추가한 경우 + return count + + result = generate_gumminsu(0) + return result + +# 입력 받기 +A, B = map(int, input().split()) + +# 금민수 개수 출력 +result = count_gumminsu(A, B) +print(result) \ No newline at end of file