problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::projection_area_of_3d_shapes::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static int projectionArea (vector< vector< int > > &grid)
 

详细描述

在文件 leetcode.h2239 行定义.

成员函数说明

◆ projectionArea()

int leetcode::projection_area_of_3d_shapes::Solution::projectionArea ( vector< vector< int > > &  grid)
static

在文件 leetcode.cpp5990 行定义.

5990 {
5991 const int n = grid.size();
5992 int xy = 0;
5993 int xz = 0;
5994 int yz = 0;
5995 auto grid_xz = vector(51, vector(51, 0));
5996 auto grid_yz = vector(51, vector(51, 0));
5997 for(int i = 0; i < n; i++) {
5998 for(int j = 0; j < n; j++) {
5999 if(grid[i][j] != 0) {
6000 xy++;
6001 }
6002 for(int k = 0; k < grid[i][j]; k++) {
6003 grid_xz[i][k] = 1;
6004 grid_yz[j][k] = 1;
6005 }
6006 }
6007 }
6008 for(int i = 0; i < 51; i++) {
6009 for(int j = 0; j < 51; j++) {
6010 if(grid_xz[i][j] != 0) {
6011 xz++;
6012 }
6013 if(grid_yz[i][j] != 0) {
6014 yz++;
6015 }
6016 }
6017 }
6018 return xy + yz + xz;
6019 }

被这些函数引用 leetcode::projection_area_of_3d_shapes::TEST().


该类的文档由以下文件生成: