with fear that I may overstep another question of mine (although this is a new problem alltogether) I still ask this question.
我有这一法典:
int blob_count(int y, int x, int gridCopy[][5], int sum){
//Local vars
int posX, posY;
//Find the position 1 behind and 1 above the starting point, and start the loop there
for(posX = -1;posX <=1; posX++){
for(posY = -1; posY <= 1; posY++){
if((y + posY) >= 0 && (x + posX) >= 0){
if((y + posY) <= 5 && (x + posX) <= 5){
if(gridCopy[posY+y][posX+x] == 1){
//Set the starting point to 0 (so it wont get calculated again)
gridCopy[posY+y][posX+x] = 0;
y = posY+y;
x = posX+x;
sum++;
blob_count(y, x, gridCopy, sum);
}
}
}
}
}
return sum;
}
问题是,每起休养费中,金额是1美元,是错失价值。 通过为每次休养手术提供印刷结果:
sum = 1
sum = 2
sum = ...
sum = n
然而,通过在休息室外(返回前的权利)印刷出钱,那是巨大的。
sum = n
sum = ...
sum = 2
sum = 1
return sum; // = 1
这一点显然是错误的,因为我想到的是全部数字,而不是最低数字。 返回是否对错位有价值? 我试图在休养呼吁(在休息期间)之后将其付诸行动。