トップ 差分 一覧 Farm ソース 検索 ヘルプ PDF RSS ログイン

2017da3.cpp

#include <stdio.h>
int main(void)
{
int set[1000]={0};
int a, b;
int c=1;
int i,j;

int x,y;
int tt;
int hh=0;

while(c!=0){
	scanf("%d %d", &a, &b);
	if(a!=0&&b!=0){
		for(i=0;i<a;i++){
			scanf("%d",&set[i]);
		}
		for(i=0;i<a-1;i++){
			for(j=a-1;j>i;j--){
				x=set[i];
				y=set[j];

				tt=x+y;
				if(tt<=b && hh<=tt){
					hh=tt;
					
				}

			}

		}
		if(hh!=0){
			printf("%d \n" ,hh);
		}
		else{
			printf("NONE\n");
		}
		hh=0;
	}

	else{
		c=0;
	}
}
}