View Code of Problem 133

#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<iostream>
#include<stack>
#include<time.h>
using namespace std;
/*test*/
//#define as '\x41'
//int atoi(char s[]);
//int strlen(char s[]);
//void squeeze(char s[], char c);
//void strcat(char s[], char t[]);
//int bitcount(unsigned x);

void judge(int n, int x)
{
	int data[100000];
	int a,b,c;
	for (a = 0;a < n;a++)
		scanf("%d", &data[a]);
	for (b = 0;b < n;b++)
	{
		for (c = 0;c < n;c++)
		{
			if ((data[b] + data[c]) == x)
			{
				printf("YES\n");
				return;
			}
		}
	}
	printf("NO\n");
	return;
}

int main()
{
	int t, n, x;
	scanf("%d", &t);
	int i;
	for (i = 0;i < t;i++)
	{
		scanf("%d%d", &n, &x);
		judge(n, x);
	}

}
/*
Main.c:4:9: fatal error: iostream: No such file or directory
 #include<iostream>
         ^~~~~~~~~~
compilation terminated.
*/

Double click to view unformatted code.


Back to problem 133