#C3632. Pair Sum in Array
Pair Sum in Array
Pair Sum in Array
You are given an array of integers and an integer \( k \). Your task is to determine whether there exist two distinct numbers in the array whose sum is exactly \( k \). This problem is common in coding contests and requires efficient handling of input and output via standard input (stdin) and standard output (stdout).
Problem Statement: Given an array \( A = [a_1, a_2, \dots, a_n] \) and an integer \( k \), determine if there exist indices \( i \) and \( j \) (with \( i \neq j \)) such that \( a_i + a_j = k \). If such a pair exists, output "True"; otherwise, output "False".
Note: The solution must read input from stdin and write the result to stdout.
inputFormat
The first line contains an integer ( n ), the number of elements in the array. The second line contains ( n ) space-separated integers representing the array. The third line contains the integer ( k ).
outputFormat
Print "True" if there are two distinct numbers in the array that sum to ( k ); otherwise, print "False".## sample
4
10 15 3 7
17
True