/*
struct TreeNode {
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
	TreeNode(int x) :
			val(x), left(NULL), right(NULL) {
	}
};*/
/*
    判断输入
    dfs
    满足条件
    if(叶子节点 && val == target) {
        ret.push(vec);
        return;
    }
    dfs(vec, root->Left, targt - sum,)
    左右开弓
*/
class Solution {
public:
    vector<vector<int>> ret;
    void dfs(TreeNode* root, vector<int> &vec, int target) {
        if (!root) {
            return;
        }        
//         先把当前值push到vec中,如果恰好满足题意就,return
        vec.push_back(root->val);
        if (!root->left && !root->right && root->val == target) {
            ret.push_back(vec);
        }
        // 开始dfs
        dfs(root->left, vec, target - root->val);
        dfs(root->right, vec, target - root->val);
        vec.pop_back();
    }
    
    vector<vector<int> > FindPath(TreeNode* root,int expectNumber) {
        if(!root) {
            return ret;
        }
        vector<int> vec;
        dfs(root, vec, expectNumber);
        return ret;
    }
};