¶
2006-01-03 05:40:25 Accepted 0.012 Minimum 56031 C++ 10189 - Minesweeper
감 ¶
.
겠 간게 2 고 8 .
기 100 x 100 간 결 .
길 -.-;;
겠 간게 2 고 8 .
기 100 x 100 간 결 .
길 -.-;;
¶
Presentation Error . 그 경 .
고 . .
결과 기 경 고 .
if outputNumber > 1 Presentation Error 게 결.
고 . .
결과 기 경 고 .
if outputNumber > 1 Presentation Error 게 결.
¶
~cpp // Minesweeper // UVa ID : 10189 // 2 (1,1) . #include <iostream> //#include <fstream> using namespace std; #define ArSize 102 void process(char data[][ArSize], int row, int col); void init_array(char data[][ArSize], int row, int col); void output(char data[][ArSize], int row, int col); //ifstream fin("input.txt"); int main() { char data[ArSize][ArSize]; int inputRow, inputCol; int outputNumber = 1; int i, j; while (cin >> inputRow >> inputCol) { // if ((inputRow == 0) && (inputCol == 0)) break; // 기 (경계값까 '.' 기) init_array(data, inputRow + 1, inputCol + 1); // (1,1) . for (i = 1; i <= inputRow; i++) { for (j = 1; j <= inputCol; j++) { cin >> data[i][j]; } } // 기 process(data, inputRow, inputCol); // ( 경 !!) if (outputNumber > 1) cout << endl; cout << "Field #" << outputNumber++ << ":" << endl; output(data, inputRow, inputCol); } return 0; } void process(char data[][ArSize], int row, int col) { int i, j; char count = '0'; for (i = 1; i <= row; i++) { for (j = 1; j <= col; j++) { // pass if (data[i][j] == '*') continue; else { // if (data[i - 1][j - 1] == '*') count++; // if (data[i - 1][j] == '*') count++; // if (data[i - 1][j + 1] == '*') count++; // if (data[i][j + 1] == '*') count++; // if (data[i + 1][j + 1] == '*') count++; // if (data[i + 1][j] == '*') count++; // if (data[i + 1][j - 1] == '*') count++; // if (data[i][j - 1] == '*') count++; data[i][j] = count; count = '0'; } } } } // 기 void init_array(char data[][ArSize], int row, int col) { int i, j; for (i = 0; i <= row; i++) { for (j = 0; j <= col; j++) { data[i][j] = '.'; } } } // - void output(char data[][ArSize], int row, int col) { int i, j; for (i = 1; i <= row; i++) { for (j = 1; j <= col; j++) { cout << data[i][j]; } cout << endl; } }