-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ2875.java
More file actions
35 lines (31 loc) · 813 Bytes
/
Q2875.java
File metadata and controls
35 lines (31 loc) · 813 Bytes
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
31
32
33
34
35
/**
* Date: 2018. 9. 17.
* Author: inhyuck | https://github.com/inhyuck
* Solution URL: https://github.com/skhucode/skhucode-inhyuck
* Title: 대회 or 인턴
* Problem: 링크 참조
* URL: https://www.acmicpc.net/problem/2875
*/
package io.inhyuck.greedy;
import java.util.Scanner;
public class Q2875 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int m = scanner.nextInt();
int k = scanner.nextInt();
int count = 0;
while (true) {
if (n < 2 || m < 1) {
break;
}
n -= 2;
m -= 1;
if (n + m < k) {
break;
}
count++;
}
System.out.println(count);
}
}