上一页 1 ··· 4 5 6 7 8
摘要: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. /** * Definition for a point. * struct Point { * i 阅读全文
posted @ 2016-06-14 14:45 ranran1203 阅读(270) 评论(0) 推荐(0)
摘要: 地上有一个m行和n列的方格。一个机器人从坐标0,0的格子开始移动,每一次只能向左,右,上,下四个方向移动一格,但是不能进入行坐标和列坐标的数位之和大于k的格子。 例如,当k为18时,机器人能够进入方格(35,37),因为3+5+3+7 = 18。但是,它不能进入方格(35,38),因为3+5+3+8 阅读全文
posted @ 2016-06-13 23:08 ranran1203 阅读(327) 评论(0) 推荐(0)
摘要: 请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路径。路径可以从矩阵中的任意一个格子开始,每一步可以在矩阵中向左,向右,向上,向下移动一个格子。如果一条路径经过了矩阵中的某一个格子,则该路径不能再进入该格子。 例如 a b c e s f c s a d e e 矩阵中包含一条 阅读全文
posted @ 2016-06-13 21:50 ranran1203 阅读(909) 评论(0) 推荐(0)
摘要: class Solution {public: int Add(int num1, int num2) { while(num2!=0) { int tmp=num1^num2;//得到相加以后没有进位的数 num2=(num1&num2)<<1;//进位 num1=tmp; } return nu 阅读全文
posted @ 2016-06-05 19:39 ranran1203 阅读(171) 评论(0) 推荐(0)
摘要: 一.fopen 成功返回流指针fp ,失败返回null fopen(char * pathname,const char *mode); mode:r或rb 只读方式打开 w 或wb 写文件,有则文件内容清空,没有则创建新文件 a 或ab 文件末尾添加,有则添加,没有则创建 二.fclose (fp 阅读全文
posted @ 2016-06-05 19:22 ranran1203 阅读(459) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std;template<class T>class SqQueue{ protected: int front,rear; int maxSize; T *elem; public: SqQueue(int size); ~Sq 阅读全文
posted @ 2016-05-31 17:03 ranran1203 阅读(153) 评论(0) 推荐(0)
摘要: #include<iostream> template<class T>struct Node{ T data; Node<T> *next;};template<class T>class Queue{private: Node<T> *front, *rear;public: Queue(); 阅读全文
posted @ 2016-05-31 16:03 ranran1203 阅读(125) 评论(0) 推荐(0)
摘要: #include<iostream> template<class T>class SqStack{protected: int count; int maxSize; T *elem;public: SqStack(int size); ~SqStack(); int Length(){ retu 阅读全文
posted @ 2016-05-31 14:39 ranran1203 阅读(126) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std;template <class T>struct Node{ T data; Node<T> *next;};template <class T>class List{public: List(int len); ~Lis 阅读全文
posted @ 2016-05-31 14:12 ranran1203 阅读(120) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;template<typename T>class SqList{private: int count;//实际元素个数 int Maxsize;//数组最大长度 T *elem;public: SqList(int siz 阅读全文
posted @ 2016-05-31 11:10 ranran1203 阅读(144) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8