我正在使用查询// these are the x values
#define OBSTACLE -1
// these are empty fields
#define EMPTY -2
std::vector<int> m;
int width;
// TODO: fill the vector here with OBSTACLEs and EMPTY and set the width!
// the list contains indexes of filled, yet unprocessed fields
std::queue<int> worklist;
// now initialize the starting zeroes. I am using the indexes
// from your example matrix here.
worklist.push(1 * width + 12); m[1 * width + 12] = 0; // second row, 13th field
worklist.push(1 * width + 13); m[1 * width + 13] = 0; // second row, 14th field
worklist.push(1 * width + 14); m[1 * width + 14] = 0; // .. and so on.
worklist.push(1 * width + 15); m[1 * width + 15] = 0;
// algorithm
while (worklist.size() > 0) {
const int cur = worklist.front();
worklist.pop();
const int newval = m[cur] + 1;
int directions[4] = {0, 0, 0, 0};
if (cur >= width) {
// we are not on the first row, check upwards
directions[0] = -width;
}
if (cur % width != 0) {
// we are not on the first column, check left
directions[1] = -1;
}
if ((cur + 1) % width != 0) {
// we are not on the last column, check right
directions[2] = 1;
}
if (cur + width < m.size()) {
// we are not on the last row, check downwards
directions[3] = width;
}
// I am not calculating diagonal connections here; you also seem to
// want those. They would be trivial to add.
for (int i = 0; i < 4; ++i) {
if (directions[i] != 0) {
const int index = cur + directions[i];
if (m[index] == EMPTY) {
m[index] = newval;
worklist.push(index);
}
}
}
}
,但我在网络/预览(Chrome)中找到了此消息
错误:INSERT INTO indisponible(id_formateur,date_debut,date_fin)VALUES(0,2017-04-06,2017-04-13)
日期值不正确:第1行第'date_debut'列的'2007'
这是我的代码php:
INSERT INTO