Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. Scanner sc = new Scanner(System.in);
  2. int x = sc.nextInt();
  3.  
  4. int[][] numberPair = new int [2][x];
  5.  
  6.  
  7.  
  8. for(int i=0; i<x; i++){
  9. for(int k=0; k<2; k++){
  10.  
  11.  
  12. numberPair[k][i] = sc.nextInt();
  13. }
  14. }
  15.  
  16. int[] solution = new int[x];
  17.  
  18. for(int i=0; i<x; i++){
  19.  
  20. if(numberPair[0][i]<numberPair[1][i]){
  21. //a minimum
  22. solution[i] = numberPair[0][i];
  23. }
  24. else {
  25. //b min
  26. solution[i] = numberPair[1][i];
  27. }
  28. for(i=0; i<x; i++)
  29. System.out.printf(solution[i] + " ");
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement