Created
May 15, 2018 11:53
-
-
Save henrybear327/c4907950ae336457ee359fa6575ed990 to your computer and use it in GitHub Desktop.
recursion_witchcraft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int main() | |
{ | |
int ncase; | |
scanf("%d", &ncase); | |
while (ncase--) { | |
int d, a, b, c, A, B, C; | |
scanf("%d %d %d %d %d %d %d", &d, &a, &b, &c, &A, &B, &C); | |
bool ok = false; | |
for (int i = 0; i <= a; i++) | |
for (int j = 0; j <= b; j++) | |
for (int k = 0; k <= c; k++) | |
if (d == i * A + j * B + k * C) | |
ok = true; | |
printf("%s\n", ok ? "yes" : "no"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment