Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <stdlib.h>
- #include <ctype.h>
- int niz[2000000];
- int main()
- {
- int t, n, m, tre, i, poz, rj, j, k, pom;
- scanf ("%d", &t);
- for (i = 0; i < t; i++){
- rj = 0;
- poz = 1;
- scanf ("%d %d", &n, &m);
- niz[0] = m;
- for (j = 0; j < n; j++){
- scanf ("%d", &tre);
- pom = poz;
- if (rj == 0){
- for (k = 0; k < pom; k++){
- niz[poz] = niz[k] - tre;
- if (niz[poz] == 0) rj = 1;
- poz++;
- }
- }
- }
- if (rj == 1) printf ("Yes\n");
- else printf ("No\n");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment