반응형
https://www.acmicpc.net/problem/3733
3733번: Shares
A group of N persons and the ACM Chief Judge share equally a number of S shares (not necessary all of them). Let x be the number of shares aquired by each person (x must be an integer). The problem is to compute the maximum value of x. Write a program that
www.acmicpc.net
간단한 수식을 출력하는 문제였습니다.
📕 풀이방법
📔 입력 및 초기화
group 수 n과 주식수 s를 입력받습니다.
📔 정답출력
n과 심판이 s를 나눠가지므로 s / (n+1)를 출력합니다.
📕 Code
#include <bits/stdc++.h>
using namespace std;
int n, s;
int main(){
while(cin >> n >> s)
cout << s/(n+1) << '\n';
}
*더 나은 내용을 위한 지적, 조언은 언제나 환영합니다.
'Algorithm > Implementation' 카테고리의 다른 글
(C++) - 백준(BOJ) 25311 : UCPC에서 가장 쉬운 문제 번호는? (0) | 2022.07.04 |
---|---|
(C++) - 백준(BOJ) 25314 : 코딩은 체육과목 입니다. (0) | 2022.07.03 |
(C++) - 프로그래머스(연습문제) : JadenCase 문자열 만들기 (0) | 2022.06.30 |
(C++) - 백준(BOJ) 25304 : 영수증 (0) | 2022.06.26 |
(C++) - 프로그래머스(월간코드챌린지) : 이진 변환 반복하기 답 (0) | 2022.06.24 |