【 Problem description 】 Your friend suggested playing a game ： Will be written with numbers n Put the paper in your pocket , You can draw pieces of paper from your pocket three times , Every time you write down the number on the piece of paper, put it back in your pocket , If the sum of these three numbers is m, You win , Or your friend will win . Please write a program , Judge when the number written on the piece of paper is k1,k2,…,kn Whether the sum of three times of extraction is m Scheme of .

【 Input form 】 The first line of input is a positive integer  n  Indicates the number of pieces of paper in the pocket （int type ） The second line is a positive integer that represents the sum of three numbers   Third behavior n An integer represents the number on each piece of paper （int type ）

【 Output form 】 If there is a satisfactory scheme , output Y, otherwise , output N.

【 sample input 】

3

10

2 3 5

【 sample output 】

Y

Problem solving analysis ： The triple cycle of violence leads directly to
import java.util.Scanner; public class p1 { public static void main(String[]
args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m =
sc.nextInt(); int [] arr = new int[n]; for(int i = 0; i < n; i++) arr[i] =
sc.nextInt(); int flag = 0; for(int i = 0; i < n-2; i++) { for(int j = 1; j <
n-1; j++) { for(int k = 2; k < n; k++) { if(arr[i] + arr[j] + arr[k] == m) {
flag = 1; break; } } } } if(flag == 1) System.out.println("Y"); else
System.out.println("N"); } }

Technology
Daily Recommendation