#K89122. Has Pair With Sum

    ID: 37461 Type: Default 1000ms 256MiB

Has Pair With Sum

Has Pair With Sum

Given a list of integers and a target sum \(T\), determine if there exist two distinct numbers in the list whose sum equals \(T\). The program should read the input from standard input and output the result to standard output.

Task:

  • Read an integer \(n\) representing the number of integers in the list.
  • Read \(n\) space-separated integers.
  • Read an integer \(T\) denoting the target sum.
  • Print True if there exist two distinct numbers that sum to \(T\); otherwise, print False.

Note: The solution must use standard input (stdin) and standard output (stdout).

inputFormat

The first line contains an integer \(n\) (the number of elements in the list).
The second line contains \(n\) space-separated integers.
The third line contains an integer \(T\) which is the target sum.

outputFormat

Output a single line: True if there exist two distinct elements in the list whose sum equals \(T\), and False otherwise.

## sample
4
2 7 11 15
9
True