第三题,请教思路哪里出错了
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <math.h>
#include <functional>
#include <string>  
using namespace std;

typedef long long LL;

const LL MOD = 1000000007;
int X, Y;
int K;
int dx[] = { -2, -2, -1, -1, 1, 1, 2, 2 };
int dy[] = { 1, -1, 2, -2, 2, -2, 1, -1 };

void dfs(LL& res, int k, int i, int j){
    if (k <= 0) {
        if (i == X && j == Y)
            res = (res + 1) % MOD;
        return;
    }
    for (int t = 0; t < 8; ++t) {
        int x = i + dx[t], y = j + dy[t];
        if (0 <= x && x < 10 && 0 <= y && y < 10){
            dfs(res, k - 1, x, y);
        }
    }
}

int main(){

    while (scanf("%d", &K) != EOF) {
        scanf("%d%d", &X, &Y);
        LL res = 0;
        dfs(res, K, 0, 0);
        printf("%lld\n", res);
    }
    system("pause");
    return 0;
}