nemova1973
14.05.2022 05:46

Problem 2 (only c++)
1 second
256 megabytes
everyone is afraid of something. someone is afraid of darkness, someone is afraid of heights, someone is afraid of public toilets (all of us are afraid of public toilets), someone is afraid of debts… there are many fears, but the greatest among all for unknown_user2019 is choosing a land for planting strawberries. unknown_user2019's land can be described as a matrix with n rows and m columns. some of the fields in the matrix are suitable for planting strawberries and some are not – weeds grow there. unknown_user2019 is looking for rectangular parts of the land that are completely filled with fields suitable for strawberry planting. those kinds of rectangles are called suitable rectangles. also, unknown_user2019 is interested in the potential value of all fields in the matrix. the potential value of each field in the matrix is defined as the number of suitable rectangles that contain that field. since unknown_user2019 has troubles facing his fears, he asks you to only calculate the sum of all the fields' potential values. input the first line contains two positive integers n and m (1 ≤ n, m ≤ 2 000), dimensions of the land. the next n lines contains m characters each, representing the landscape. each character can be either a ‘.’ (dot) which represents a field suitable for planting or a ‘#’ which represents weeds. output output the sum of all potential values of the matrix’s fields.
scoring in test cases worth 20% of the total points, it will hold that 1 ≤ n, m ≤ 10. in test cases worth additional 30% of the total points, it will hold that 1 ≤ n, m ≤ 300.
input
2 3 .#. .#
output
8
input
3 3
output
100
input
3 4 ..#. # #
output
40
clarification of the first sample test: the following matrix describes the potential values of the land’s fields. the sum of all potential values is 8.
2 0 1
3 2 0

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
базарганово
11.12.2020 02:16
Червь  – программа, которая делает копии самой себя. Ее вред заключается в захламлении компьютера, из-за чего он начинает работать медленнее. Отличительной особенностью червя является то, что он не может стать частью другой безвредной программы.Троянская программа (троянский конь, троян)Троянская программа маскируется в других безвредных программах. До того момента как пользователь не запустит эту самую безвредную программу,  троян не несет никакой опасности. Тронская программа может нанести различный ущерб для компьютера. В основном трояны используются для кражи, изменения или удаления данных. Отличительной особенностью трояна является то, что  он не может самостоятельно размножаться.
0,0(0 оценок)
Ответ:
levkim
24.09.2020 22:05
Вычислительная техника является важнейшим компонентом процесса вычислений и обработки данных. первыми приспособлениями для вычислений были, вероятно, всем известные счётные палочки, которые и сегодня используются в начальных классах многих школ для обучения счёту. развиваясь, эти приспособления становились более сложными, например, такими как финикийские глиняные фигурки, также предназначаемые для наглядного представления количества считаемых предметов. такими приспособлениями, похоже, пользовались торговцы и счетоводы того времени.
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота