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
EOF
- 제목
Shares
- 조건
시간 제한 : 1 초
메모리 제한 : 128 MB
- 문제
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 reads pairs of integer numbers from an input text file. Each pair contains the values of 1 ≤ N ≤ 10000 and 1 ≤ S ≤ 109 in that order. The input data are separated freely by white spaces, are correct, and terminate with an end of file. For each pair of numbers the program computes the maximum value of x and prints that value on the standard output from the beginning of a line, as shown in the example below.
예제 입력1 | 예제 출력1 |
1 100 2 7 10 9 10 10 |
50 2 0 0 |
#include <iostream>
#include <algorithm>
using namespace std;
#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
int main() {
fastio;
int N, x;
while(cin >> N >> x){
cout << x / (N + 1) << endl;
}
return 0;
}
'Problem Solving > BaekJoon' 카테고리의 다른 글
[BOJ/백준] 25592 - 바둑돌 게임 (0) | 2022.09.19 |
---|---|
[BOJ/백준] 25591 - 푸앙이와 종윤이 (0) | 2022.09.19 |
[BOJ/백준] 25624 - SNUPTI (0) | 2022.09.17 |
[BOJ/백준] 25600 - Triathlon (0) | 2022.09.17 |
[BOJ/백준] 25625 - 샤틀버스 (0) | 2022.09.17 |