본문 바로가기

Algorithm/Implementation

(C++) - 백준(BOJ) 3733 : Shares

반응형

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';
}

*더 나은 내용을 위한 지적, 조언은 언제나 환영합니다.