Skip to content

Commit c5fbf04

Browse files
committed
jan long challenge
1 parent a00328c commit c5fbf04

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

January Long Challenge/Q1.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package jan_long;
2+
import java.util.*;
3+
public class Q1 {
4+
5+
public static void main(String[] args) {
6+
Scanner sc=new Scanner(System.in);
7+
int test=sc.nextInt();
8+
while(test-->0) {
9+
int n,k,d;
10+
n=sc.nextInt();
11+
k=sc.nextInt();
12+
d=sc.nextInt();
13+
int arr[]=new int[n];
14+
for(int i=0;i<n;i++) {
15+
arr[i]=sc.nextInt();
16+
}
17+
int sum=0;
18+
for(int i=0;i<n;i++) {
19+
sum+=arr[i];
20+
}
21+
int res=sum/k;
22+
if(res>d) {
23+
res=d;
24+
}
25+
System.out.println(res);
26+
}
27+
sc.close();
28+
}
29+
30+
}

0 commit comments

Comments
 (0)