【LintCode 入门】454. 矩阵面积
2018-01-15 13:37
513 查看
1.问题描述:
实现一个矩阵类
两个共有的成员变量
一个构造函数,接受2个参数 width 和 height 来设定矩阵的宽度和高度。
一个成员函数
2.代码:
实现一个矩阵类
Rectangle,包含如下的一些成员变量与函数:
两个共有的成员变量
width和
height分别代表宽度和高度。
一个构造函数,接受2个参数 width 和 height 来设定矩阵的宽度和高度。
一个成员函数
getArea,返回这个矩阵的面积。
2.代码:
class Rectangle: ''' * Define a constructor which expects two parameters width and height here. ''' # write your code here def __init__(self,width,height): self.width=width self.height=height ''' * Define a public method `getArea` which can calculate the area of the * rectangle and return. ''' # write your code here def getArea(self): area=self.width*self.height return area
相关文章推荐
- 【LintCode】454.矩阵面积(入门)解题报告
- Lintcode 入门-454. 矩阵面积
- LintCode-[入门] 454. 矩阵面积
- 【LintCode-454】矩阵面积(Java实现)
- LintCode_Java旅程 矩阵面积
- LintCode之矩阵面积
- hdu 1542 矩形面积并 &&hdu 1255 矩形面积交 && hdu 1828 矩阵周长并 线段树+扫描线入门
- 一、lintcode刷题记录--矩阵面积、二叉树的最大节点、整数排序、删除链表中的元素
- (lintcode)第454题 矩阵面积
- lintcode-162-矩阵归零
- 【LintCode 入门】463. 整数排序
- 华为机考 给你一个N*M的矩阵,每个位置的值是0或1,求一个面积最大的子矩阵,这个矩阵必须是一个正方形,且里面只能由1构成,输出最大的正方形边长。其中n,m<=400;
- 九度 1497:面积最大的全1子矩阵
- HDU1575 && HDU1757(矩阵入门)
- 线性代数入门(2) - 矩阵,向量
- 蓝桥杯 Java 入门训练 圆的面积
- LintCode入门练习——466. 链表节点计数
- LintCode入门练习——632. 二叉树的最大节点
- hdu 1575 Tr A (矩阵快速幂入门题)
- bf8e 入门训练 圆的面积