May 2023 Youth Software Programming C Language Level 3 Real Questions and Answers

1. Find two elements whose sum is K

In an integer sequence of length n (n < 1000), determine whether there are two elements whose sum is k.
Time limit: 1000
Memory limit: 65536
Input
The length n and k of the input sequence on the first line, separated by spaces. The second line enters n integers in the sequence, separated by spaces.
Output
If the sum of some two elements is k, output yes, otherwise output no.
Sample input
9 10
1 2 3 4 5 6 7 8 9
Sample output
yes
Test question analysis:

#include<bits/stdc++.h>
using namespace std;
int main() {
   
    
    
	int a

Supongo que te gusta

Origin blog.csdn.net/owbc_/article/details/131273262
Recomendado
Clasificación