-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChefAndFruits.java
More file actions
32 lines (27 loc) · 824 Bytes
/
ChefAndFruits.java
File metadata and controls
32 lines (27 loc) · 824 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
package problems.codechef;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Created by hardCode on 1/25/2016.
*/
public class ChefAndFruits {
public static void main(String[] args) throws IOException {
int n,m,k,p,q,t,temp;
String s[];
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
t=Integer.parseInt(br.readLine());
while (t-->0){
s=br.readLine().split("\\s");
n=Integer.parseInt(s[0]);
m=Integer.parseInt(s[1]);
k=Integer.parseInt(s[2]);
p=(n<m?n:m);
q=(n>m?n:m);
p+=k;
temp=p-q;
if (temp>=0) System.out.println(0);
else System.out.println(Math.abs(temp));
}
}
}