View Code of Problem 133

#include<stdio.h>
int main(){
	int t,n,x;
	int flag=0;
	scanf("%d",&t);
	int s[100000];
	for(int i=0;i<t;i++){
		scanf("%d %d",&n,&x);
		for(int j=0;j<n;j++){
			scanf("%d",&s[j]);
		}
		for(int k=0;k<n;k++){
			for(int z=k+1;z<n;z++){
				if((s[k]+s[z])==x){
					flag=1;
					break;
				}
			}
		}
		if(flag==0)printf("NO\n");
		if(flag==1)printf("YES\n");
		flag=0;
	}
}

Double click to view unformatted code.


Back to problem 133