色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

求二維數組周邊元素之和

錢淋西2年前15瀏覽0評論

求二維數組周邊元素之和?

#include

using namespace std;

int add(int* a, int n, int m) {

int i,j;

int sum = 0;

for (i = 0; i

if (i == 0 || i == n-1) {

for ( j = 0; j

sum += a[i*m+j];

}

}

else {

sum += a[i*m];

sum += a[i*m+m-1];

}

return sum;

}

int main() {

int a[4][5];

int i,j,n;

n = 0;

for (i = 0; i

for (j = 0; j

a[i][j] = n;

cout

}

cout

}

cout

return 0;

}

java 多維數組,求二維數組周邊元素之和