WEBSITE RETURNED, HOWEVER SUBMIT QUANTITY IS RESTRICTED PER DAY TO VERY LITTLE (UNDER JUDGE0 NEW POLICY, API PROVIDER). Therefore it is very much for you to pay attention TEST CAREFULLY CODE BEFORE SUBMIT.

Map

Source: http://laptrinh.ictu.edu.vn

Thai Nguyen province is land planning projects across the province and divide again by regions. Leaders decided to draw a map for easy management. Maps are rectangular size MxN. With symbols:
'#' Is the mountainous area.
'-' is a residential area but no person in.
'*' Is a residential area was inhabited.
The mountain forest land will be divided into separate residential areas. 2 common point called a residential area if it is situated next to each other in the longitudinal direction or transverse direction. Surrounded map is always a mountain forest. Always have a minimum 1 residential area on the map.

Your task is to calculate the average number of people living in residential areas.

Input:
– The first line contains the number t – number of tests ( 0 < t < 40) - Mỗi test tiếp theo sẽ có: + Dòng 1 chứa 2 số M và N là kích thước bản đồ hình chữ nhật. ( M, N <= 100) + Các dòng tiếp theo mô tả thông tin bản đồ. Output:
– t line, each line is the average number of people living in residential areas. Results rounded to 2 decimal.

For example:

input:
2
5 5
#####
#**##
###*#
#**##
#####
6 10
##########
#---*--*##
###-*----#
#**#######
##***---##
##########
output:
1.67
4.00

Explain:
– In test 1, we have 3 residential and 5 People => TB = 1.67
– In test 2, we have 2 residential and 8 People => TB = 4.00

You are not logged in? Log in to Submit Now!

21 Comments

Add a Comment