¶
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; } }