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

10109번 - Troyangles 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB106604351.807%

문제

Troy loves triangles. He especially likes counting triangles. He has an N-by-N grid consisting of either “.” or “#” characters. Help him count the number of triangles formed only by “#” characters in the grid. Triangles are of the form

 #
 # ### 
#, ###, #####, etc.

More formally, a triangle of height h consists of h rows for some positive integer h. The ith row contains 2i − 1 “#” characters for i = 1, . . . , h. The rows are centred above each other so that they are symmetrical about a vertical line down their middle.

입력

The first line contains the number N (1 ≤ N ≤ 2000) representing the size of the grid. The next N lines each contain N characters as described above.

출력

Output the number of triangles in the grid.

제한

예제 입력 1

5
.....
.###.
.###.
#####
.....

예제 출력 1

16

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2014 > CCO 2014 1번

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

출처

대학교 대회

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

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