Last active
March 6, 2020 08:51
-
-
Save nobodyzxc/1463033d9a63f91053bec0194f79ef31 to your computer and use it in GitHub Desktop.
This file contains 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<cstdio> | |
#define LL long long | |
bool go_tree(LL tar, LL cur, bool &isNIL){ | |
LL val; | |
bool res = false, ll = false, rl = false; | |
if(scanf("\n(%lld", &val)){ | |
res |= go_tree(tar, cur + val, ll); | |
res |= go_tree(tar, cur + val, rl); | |
res |= (ll && rl && tar == cur + val); | |
} | |
else isNIL = true; | |
scanf("\n)"); | |
return res; | |
} | |
int main(){ | |
bool _; | |
LL target; | |
while(~scanf("%lld", &target)) | |
puts(go_tree(target, 0, _) ? "yes" : "no"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment