-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOneChicken.java
41 lines (35 loc) · 1.24 KB
/
OneChicken.java
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
36
37
38
39
40
41
/*
Problem: https://open.kattis.com/problems/onechicken
Author: Adrian Reithaug
Submitted: June 3rd, 2017
Time: 0.18s / 1.00s
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class OneChicken {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String[] data = reader.readLine().split(" ");
int numPeople = Integer.parseInt(data[0]);
int numPieces = Integer.parseInt(data[1]);
if (numPeople > numPieces) {
int need = numPeople - numPieces;
System.out.print("Dr. Chaz needs ");
if (need == 1) {
System.out.print(need + " more piece of chicken!");
} else {
System.out.print(need + " more pieces of chicken!");
}
} else {
int left = numPieces - numPeople;
System.out.print("Dr. Chaz will have ");
if (left == 1) {
System.out.print(left + " piece of chicken left over!");
} else {
System.out.print(left + " pieces of chicken left over!");
}
}
System.out.println("");
}
}