{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003eRain has pummeled on the cows\u0027 field, a rectangular grid of R rows and C columns (1 \u0026lt;\u003d R \u0026lt;\u003d 50, 1 \u0026lt;\u003d C \u0026lt;\u003d 50). While good for the grass,\r\nthe rain makes some patches of bare earth quite muddy. The cows, being meticulous grazers, don\u0027t want to get their hooves dirty while they eat.\r\n\u003c/p\u003e\u003cp\u003e\r\n\r\nTo prevent those muddy hooves, Farmer John will place a number of wooden boards over the muddy parts of the cows\u0027 field. Each of the boards is 1 unit wide, and can be any length long. Each board must be aligned parallel to one of the sides of the field.\u003c/p\u003e\u003cp\u003e\r\n\r\nFarmer John wishes to minimize the number of boards needed to cover the muddy spots, some of which might require more than one board to cover. The boards may not cover any grass and deprive the cows of grazing area but they can overlap each other.\u003c/p\u003e\u003cp\u003e\r\n\r\nCompute the minimum number of boards FJ requires to cover all the mud in the field.\r\n\r\n\u003c/p\u003e\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003e\u003ci\u003et\u003c/i\u003e – the number of test cases, then \u003ci\u003et\u003c/i\u003e test cases follows. \u003cbr\u003e\r\nEach test case is of the following form: \u003cbr\u003e\r\nTwo space-separated integers: \u003ci\u003eR\u003c/i\u003e and \u003ci\u003eC\u003c/i\u003e, then R lines follows\u003cbr\u003e\r\nEach line contains a string of C characters, with \u0027*\u0027 representing a muddy patch, and \u0027.\u0027 representing a grassy patch. No spaces are present.\r\n\r\n\u003c/p\u003e\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003eFor each test case output a single integer representing the number of boards FJ needs.\u003cbr\u003e\r\n\r\n\u003c/p\u003e\u003ch3\u003eExample\u003c/h3\u003e\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n4 4\r\n*.*.\r\n.***\r\n***.\r\n..*.\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n\r\n\u003cb\u003eOutput details:\u003c/b\u003e\r\nBoards 1, 2, 3 and 4 are placed as follows:\r\n1.2.\r\n.333\r\n444.\r\n..2.\r\nBoard 2 overlaps boards 3 and 4.\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e"}}]}