|
|
back to boardWhat's in test #4? Please, help Hi. My solution works on my computer but there is not. What's wrong with my code? #include <iostream> using namespace std; int main() { int n, c = 1; int pix[100][100]; for ( int i = 0; i < n; ++i ) { for ( int j = 0; j < n; ++j ) { pix[i][j] = 0; } } cin >> n; for ( int i = 0; i < n; ++i ) { for ( int j = (n - 1); j >= 0; --j ) { if ( pix[i][j] > 0 ) continue; int ii = i, jj = j; while ( ii < n && jj < n ) { pix[ii][jj] = c; ii++; jj++; c++; } } } for ( int i = 0; i < n; ++i ) { for ( int j = 0; j < n; ++j ) { cout << pix[i][j] << " "; } cout << endl; } return 0; } Edited by author 10.06.2017 15:16 Edited by author 10.06.2017 15:16 Edited by author 10.06.2017 15:17 |
|
|