-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestion48.java
More file actions
37 lines (37 loc) · 669 Bytes
/
Question48.java
File metadata and controls
37 lines (37 loc) · 669 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
36
37
import java.util.*;
class Coupon
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
while(k>0){
int c=0;
int sum=0;
int x=sc.nextInt();
int y=sc.nextInt();
int z=sc.nextInt();
int arr[]=new int[x];
for(int i=0;i<x;i++)
{
arr[i]=sc.nextInt();
c=c+arr[i];
}
for(int i=0;i<x;i++){
if(arr[i]>z){
sum=sum+(arr[i]-z);
}
}
int m=y+sum;
if(m<c)
{
System.out.println("COUPON");
}
else
{
System.out.println("NO COUPON");
}
k--;
}
}
}