300P

Category
아이템: 300P(1)
포스트 갯수1

RectangularGrid

By 불타는 아잍(IT)스크림 | 2020년 3월 14일 | 
Code public class RectangularGrid{ public long countRectangles(int width, int height) { long res = 0; for(int i = 0; i < height; i++) { for(int j = 0; j < width; j++) { if(i == j) continue; res += (height-i) * (width-j); } } return res; }} Problem 격자 무늬에서 직사각형의 개수를 구하라. (정사각형 제외) 예) 3x3 격자에서 1