// 基本テンプレート #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++) #define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++) #define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--) #define debug(...) fprintf(stderr, __VA_ARGS__) #define int long long int template void chmax(T &a, T b) {a = max(a, b);} template void chmin(T &a, T b) {a = min(a, b);} template void chadd(T &a, T b) {a = a + b;} typedef pair pii; typedef long long ll; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; const ll INF = 1001001001001001LL; const ll MOD = 1000000007LL; int H, W; char board[60][60]; double solve(int lx, int rx, int ly, int ry) { double mi = 1e100; for(int x=lx; x<=rx; x++) { for(int y=ly; y<=ry; y++) { double sum = 0.0; for(int i=0; i> H >> W; for(int i=0; i> board[i][j]; } } double ans = 1e100; chmin(ans, solve(0, H-1, -1, -1)); chmin(ans, solve(0, H-1, W, W)); chmin(ans, solve(-1, -1, 0, W-1)); chmin(ans, solve(H, H, 0, W-1)); cout << setprecision(12) << ans << endl; return 0; }