#C3771. Two Sum Problem
Two Sum Problem
Two Sum Problem
Given an array of integers and a target sum \(k\), your task is to determine whether there exist two distinct indices \(i\) and \(j\) such that \(a_i + a_j = k\). If such a pair exists, output 1; otherwise, output 0.
The input is provided via standard input (stdin) and the output should be printed to standard output (stdout).
inputFormat
The first line contains a single integer \(n\), the number of elements in the array. The second line contains \(n\) space-separated integers representing the array elements. The third line contains an integer \(k\), the target sum.
outputFormat
Output a single integer: output 1 if there exist two distinct indices \(i\) and \(j\) such that \(a_i + a_j = k\); otherwise, output 0.
## sample5
1 2 3 9 10
8
0