UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#211949#3815. 种树PanjunnanCompile Error//C++1012b2024-10-13 09:02:572024-10-13 12:52:46

answer

#include <iostream>
#include <vector>
using namespace std;
int n,m,k; 
vector<vector<int> > aaa; 
int fangfa =0; 
bool pd(int row, int col) {
    if (row > 0 && aaa[row - 1][col] ==1) return false; 
    if (row < n - 1 && aaa[row + 1][col] ==1) return false; 
    if (col > 0 && aaa[row][col - 1] == 1) return false; 
    if (col < m - 1 && aaa[row][col + 1] ==1) return false; 
    return true;
}

void ccc(int placedTrees, int startRow, int startCol) {
    if (placedTrees ==k) {
        fangfa++; 
        return;
    }
    
    for (int i = startRow; i<n; ++i) {
        for (int j = (i == startRow ? startCol : 0); j<m; ++j) {
            if (aaa[i][j]==0 && pd(i,j)) {
                aaa[i][j]=1;
                ccc(placedTrees+1,i,j); 
                aaa[i][j]=0;
            }
        }
        startCol = 0; 
    }
}
int main() {
    cin>>n>>m>>k;
    aaa=vector<vector<int>>(n,vector<int>(m, 0)); 
    
    ccc(0, 0, 0); 
    cout<<fangfa<<endl;
    return 0;
}

详细

answer.code: In function 'int main()':
answer.code:34:26: error: '>>' should be '> >' within a nested template argument list
     aaa=vector<vector<int>>(n,vector<int>(m, 0)); \x0d
                          ^