#include typedef GLfloat point2d[2]; // a point data type void triangle( point2d a, point2d b, point2d c) // display a triangle { glBegin(GL_TRIANGLES...
分类:
其他好文 时间:
2014-06-18 21:02:32
阅读次数:
334
水题,注意数据范围即可#include #include #include using
namespace std;typedef pair Point;int main(){ int x,y; cin >> x >>y;
Point a,b; if((x>0 && y > ...
分类:
其他好文 时间:
2014-06-16 10:47:47
阅读次数:
226
Description:GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1],...
分类:
其他好文 时间:
2014-06-15 06:33:57
阅读次数:
216
Decription:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, gi...
分类:
其他好文 时间:
2014-06-14 19:46:12
阅读次数:
251
Problem B: C++习题 虚函数-计算图形面积
Description
编写一个程序,定义抽象基类Shape,由它派生出5个派生类: Circle(圆形)、Square(正方形)、Rectangle(矩形)、Trapezoid(梯形)、Triangle(三角形)。
用虚函数分别计算几种图形面积,并求它们之和。
要求用基类指针数组,使它每一个元素指向一个派生类对象。
...
分类:
其他好文 时间:
2014-06-10 15:07:53
阅读次数:
286
Problem A: C++习题 抽象基类
Description
编写一个程序,声明抽象基类Shape,由它派生出3个派生类: Circle(圆形)、Rectangle(矩形)、Triangle(三角形),用一个函数printArea分别输出以上三者的面积(结果保留两位小数),3个图形的数据在定义对象时给定。
Input
圆的半径
矩形的边长
三角...
分类:
其他好文 时间:
2014-06-10 14:32:52
阅读次数:
170
在Swift中,类的成员变量(属性)如果不需要计算,但又想在给它赋一个新值之前(或者之后)执行一段代码,可以使用willSet 和
didSet来处理.例如下面的代码样例,三角形(triangle)的边长总是与四边形(square)的边长相同. class TriangleAndSquare
{ ....
分类:
移动开发 时间:
2014-06-09 20:33:49
阅读次数:
262
【题目】
Given numRows, generate the first numRows of Pascal's triangle.
For example, given numRows = 5,
Return
[
[1],
[1,1],
[1,2,1],
[1,3,3,1],
[1,4,6,4,1]
]
【题意】
给定整数numRows, 要求生成杨辉三角的前numRows行
【思路】
杨辉三角有以下特点:
1. 第n行有n个元素
...
分类:
其他好文 时间:
2014-06-08 09:17:06
阅读次数:
196
Triangle LOVE
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 2138 Accepted Submission(s): 898
Problem Description
Recently, scienti...
分类:
其他好文 时间:
2014-06-08 02:56:49
阅读次数:
301