| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
有谁能解释下下面两种写法到底有什么不同,为什么法1WA,法2AC(C++语法问题)法1:
void findStart(int &x, int &y, int &z) {
for(x = 0; x < L; x ++) {
for(y = 0; y < R; y ++) {
for(z = 0; z < C; z ++) {
if(a[x][y][x] == 'S') {
return ;
}
}
}
}
}
int x, y, z;
findStart(x, y, z);
法2:
int x, y, z;
for(int i = 0; i < L; i ++) {
for(int j = 0; j < R; j ++) {
for(int k = 0; k < C; k ++) {
if(a[i][j][k] == 'S') {
x = i, y = j, z = k;
}
}
}
}
这两种方法得到的x、y、z到底有什么不同?
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator