CF39K.Testing

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You take part in the testing of new weapon. For the testing a polygon was created. The polygon is a rectangular field n×mn×m in size, divided into unit squares 1×11×1 in size. The polygon contains kk objects, each of which is a rectangle with sides, parallel to the polygon sides and entirely occupying several unit squares. The objects don't intersect and don't touch each other.

The principle according to which the weapon works is highly secret. You only know that one can use it to strike any rectangular area whose area is not equal to zero with sides, parallel to the sides of the polygon. The area must completely cover some of the unit squares into which the polygon is divided and it must not touch the other squares. Of course the area mustn't cross the polygon border. Your task is as follows: you should hit no less than one and no more than three rectangular objects. Each object must either lay completely inside the area (in that case it is considered to be hit), or lay completely outside the area.

Find the number of ways of hitting.

输入格式

The first line has three integers nn , mm и kk ( 1<=n,m<=10001<=n,m<=1000 , 1<=k<=901<=k<=90 ) — the sizes of the polygon and the number of objects on it respectively. Next nn lines contain mm symbols each and describe the polygon. The symbol "*" stands for a square occupied an object, whereas the symbol "." stands for an empty space. The symbols "*" form exactly kk rectangular connected areas that meet the requirements of the task.

输出格式

Output a single number — the number of different ways to hit a target.

输入输出样例

  • 输入#1

    3 3 3
    *.*
    ...
    *..
    

    输出#1

    21
    
  • 输入#2

    4 5 4
    .*.**
    ...**
    **...
    ...**
    

    输出#2

    38
    
  • 输入#3

    2 2 1
    .*
    ..
    

    输出#3

    4
    
首页