일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 파이썬
- spring
- SWEA
- php 프로그래밍 입문 연습문제
- programmers
- 자바
- 스프링
- 플러터 개발환경 설정
- php 프로그래밍 입문
- 페이코 추천인코드
- C언어
- 페이코 추천인
- 페이코 초대코드
- php 프로그래밍 입문 문제풀이
- JAVA SPRING
- 한정 분기
- 페이코 친구코드
- php 프로그래밍 입문 예제
- php 프로그래밍 입문 솔루션
- php 프로그래밍
- C
- 백준
- 플러터
- php
- 자바 스프링
- 배열
- php 프로그래밍 입문 3판
- 최단 경로
- Java
- Flutter
Archives
- Today
- Total
ImJay
[파이썬/Python] 백준 24568번 Cupcake Party 본문
반응형
[파이썬/Python] 백준 24568번 Cupcake Party
24568번: Cupcake Party
A regular box of cupcakes holds 8 cupcakes, while a small box holds 3 cupcakes. There are 28 students in a class and a total of at least 28 cupcakes. Your job is to determine how many cupcakes will be left over if each student gets one cupcake.
www.acmicpc.net
문제
A regular box of cupcakes holds 8 cupcakes, while a small box holds 3 cupcakes. There are 28 students in a class and a total of at least 28 cupcakes. Your job is to determine how many cupcakes will be left over if each student gets one cupcake.
해설
8개의 컵케이크가 들어있는 박스의 갯수 : R
3개의 컵케이크가 들어있는 박스의 갯수 : S
28명이 각 1개의 케이크를 먹을 때, 남는 컵케이크의 개수를 구해보자
left_over = R * 8 + S * 3 - 28
총 컵케이크의 갯수를 구해 28명이 먹을 컵케이크 수인 28을 빼면 남는 컵케이크의 수가 된다.
코드
R = int(input())
S = int(input())
print(R*8 + S*3 - 28)
풀이
1. 컵케이크 박스 R, S의 개수를 입력 받는다.
R = int(input())
S = int(input())
2. 남는 컵케이크 수를 출력한다.
print(R*8 + S*3 - 28)
반응형
'Solved.ac - Python > Bronze V' 카테고리의 다른 글
[파이썬/Python] 백준 24900번 한별찍기 (0) | 2022.12.03 |
---|---|
[파이썬/Python] 백준 24736번 Football Scoring (0) | 2022.12.02 |
[파이썬/Python] 백준 24309번 PABEHCTBO (0) | 2022.12.01 |
[파이썬/Python] 백준 24262번 알고리즘 수업 - 알고리즘의 수행 시간 1 (0) | 2022.11.30 |
[파이썬/Python] 백준 24086번 身長 (Height) (0) | 2022.11.30 |
Comments