Logo
(追記) (追記ここまで)

18778번 - Equilateral Triangles 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB134534246.667%

문제

Farmer John's pasture can be represented by a $N\times N$ square grid $(1\le N\le 300)$ consisting of positions $(i,j)$ for all 1ドル\le i,j\le N$. For each square of the grid, the corresponding character in the input is equal to '*' if there exists a single cow at that position and '.' if there does not exist a cow at that position.

FJ believes that the beauty of his pasture is directly proportional to the number of triples of cows such that their positions are equidistant from each other. In other words, they form an equilateral triangle. Unfortunately, it was only quite recently that FJ realized that since all of his cows are located at integer coordinates, no beautiful triples can possibly exist if Euclidean distance is used! Thus, FJ has decided to switch to use "Manhattan" distance instead. Formally, the Manhattan distance between two positions $(x_0,y_0)$ and $(x_1,y_1)$ is equal to $|x_0-x_1|+|y_0-y_1|$.

Given the grid representing the positions of the cows, compute the number of equilateral triples.

입력

The first line contains a single integer $N.$

For each 1ドル\le i\le N,$ line $i+1$ of the input contains a string of length $N$ consisting solely of the characters '*' and '.'. The $j$th character describes whether there exists a cow at position $(i,j)$ or not.

출력

Output a single integer containing the answer. It can be shown that it fits into a signed 32-bit integer.

제한

예제 입력 1

3
*..
.*.
*..

예제 출력 1

1

힌트

There are three cows, and they form an equilateral triple because the Manhattan distance between each pair of cows is equal to two.

출처

Olympiad > USA Computing Olympiad > 2019-2020 Season > USACO 2020 February Contest > Platinum 2번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /