Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
123371 | 梁乃元 | 封闭面积问题 | C++ | 通过 | 100 | 0 MS | 252 KB | 693 | 2024-01-22 21:40:50 |
#include <bits/stdc++.h> using namespace std; int a [11] [11] ; int n , sum = 0 ; void dfs ( int x , int y ) { if ( x > 10 || x < 0 || y > 10 || y < 0 || a [x] [y] == 1 ) { return ; } a [x] [y] = 1 ; dfs ( x + 1 , y ) ; dfs ( x - 1 , y ) ; dfs ( x , y + 1 ) ; dfs ( x , y - 1 ) ; return ; } int main ( ) { for ( int i = 1 ; i <= 10 ; i ++ ) { for ( int j = 1 ; j <= 10 ; j ++ ) { cin >> a [i] [j] ; } } dfs ( 0 , 0 ) ; for ( int i = 1 ; i <= 10 ; i ++ ) { for ( int j = 1 ; j <= 10 ; j ++ ) { if ( ! a [i] [j] ) { sum ++ ; } } } cout << sum << endl ; return 0 ; }