Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class Main {
- public static void main(String[] args) throws IOException {
- // System.setIn(new FileInputStream(new File("/home/arif/Documents/inout/input.txt")));
- // System.setOut(new PrintStream(new File("/home/arif/Documents/inout/output.txt")));
- Scanner scanner = new Scanner(System.in);
- int tc = scanner.nextInt();
- while (tc-- >0) {
- int bob = scanner.nextInt();
- int other = scanner.nextInt();
- int bobSum = 0;
- int otherSum = 0;
- for (int i=0;i<bob-1;i++){
- int x = scanner.nextInt();
- bobSum+=x;
- }
- for (int i=0;i<other;i++){
- int x = scanner.nextInt();
- otherSum+=x;
- }
- int min = (otherSum/other)+1;
- int max = (int) (Math.ceil((double) bobSum/(double) (bob-1))-1);
- System.out.println(min + " " + max);
- }
- scanner.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment