문제 링크: https://www.acmicpc.net/problem/11999
11999번: Milk Pails (Bronze)
Farmer John has received an order for exactly \(M\) units of milk (\(1 \leq M \leq 1,000\)) that he needs to fill right away. Unfortunately, his fancy milking machine has just become broken, and all he has are three milk pails of integer sizes \(X\), \(Y\)
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <bits/stdc++.h>
using namespace std;
int x, y, m;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> x >> y >> m;
int ans = 0;
for(int i = 0; i <= 1000; i++) for(int j = 0; j <= 1000; j++) {
if(x * i + y * j <= m)
ans = max(ans, x * i + y * j);
}
cout << ans << '\n';
return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
'USACO > Bronze' 카테고리의 다른 글
백준 12001 Load Balancing (USACO February 2016 Bronze 3번) (0) | 2020.02.27 |
---|---|
백준 12000 Circular Barn (USACO February 2016 Bronze 2번) (0) | 2020.02.27 |
백준 11978 Mowing the Field (USACO January 2016 Bronze 3번) (0) | 2020.02.27 |
백준 11977 Angry Cows (USACO January 2016 Bronze 2번) (0) | 2020.02.27 |
백준 11976 Promotion Counting (USACO January 2016 Bronze 1번) (0) | 2020.02.26 |