Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Source {
- public static void main (String[] args){
- int x = -1, y = 0, tmp;
- Scanner sc = new Scanner(System.in);
- int n = sc.nextInt();
- int k = sc.nextInt();
- int a[] = new int[n];
- for(int i = 0 ; i < n ; i++){
- tmp = sc.nextInt();
- if(tmp > 0)
- a[i] = tmp;
- }
- for(int i = 0 ; i < n ; i++){
- for(int j = 0 ; j < n ; j++){
- if(a[i] + a[j] == k && a[i] != a[j]){
- x = a[j];
- y = a[i];
- }
- }
- }
- if(x == -1)
- System.out.println(x);
- else
- System.out.println(x+" "+y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement