- 博客(10)
- 资源 (4)
- 收藏
- 关注
原创 计算一维数组代表的仿真地貌,实际可以容纳多少水量?
笔试算法题;核心是减小问题的规模,抽象出坑道存水本质上是要有U型陷槽才能存水。木桶效应,且U型的起始端点和终结小结最右端点。
2022-05-14 10:33:50 102 1
原创 计算两个链表是否存在公共节点,公共节点元素是多少?
问题:已知两个单链表有交叉节点,计算它们的第一个交叉节点。 1 //求出单链表的长度 2 int getListLength(ListNode *head) 3 { 4 int len = 0; 5 ListNode *tmp = head; 6 while(tmp){ 7 tmp = tmp->next; 8 ++len; 9 }10 .
2021-04-14 16:51:55 159
原创 ---常见的计算几何问题的快速计算机算法(计算机图形学+游戏渲染碰撞检测)
前言空间三维直角坐标系的优点是,先天性的决定了三个坐标参数的无关性,正交解耦;向量(点积和叉积)和变换以及矩阵分析都是超强大的开山架桥的工具。 如何应用解析几何的数学算法,减少中间的开方浮点数运算的次数,避免double的精度误差蔓延,需要反复打磨计算过程,把误差延后在最后几步里做统一处理。这里面可以考虑能否将已有的double(float)型数预处理变成long int; 数据类型的范围要选的恰当,避免中间运算过程越界,同时又要考虑到内存使用的经济性效率,精细化运用动态内存区;如果数据类型选用得当
2020-05-10 16:16:53 686
原创 二维矩阵存储的世界地图里,每个小方格里着色不同,求所有的国家总数
#include #include #include using namespace std;int resolution(vector > &A){ //self-defined construct struct Point { int line; int col; Point(int X, int Y) :
2016-05-16 20:28:28 431
原创 计算地铁族的来月出行计划对应的月票预支付最小花费
#include #include using namespace std;int solution( vector days){ if(days.empty()) { return 0; } if(days.size()==1) { return 2; } if(days.size()==2) { return
2016-05-16 20:22:31 214
原创 同一天内的 某停车场进场出场的费用计算收取
#include #include using namespace std;int calcTotalFees(string &E, string& L){ int totalFee=0; int startH = (E.at(0)-'0')*10 + (E.at(1)-'0'); int endH = (L.at(0)-'0')*10 + (L.at(1)
2016-05-16 20:18:44 930
原创 二维矩阵存储的着色地图方格里,求出总的国家数。
#include #include #include using namespace std;int resolution(vector > &A){ //self-defined construct struct Point { int line; int col; Point(int X, int Y) :
2016-05-16 20:16:31 209
原创 一个二维矩阵存储的世界地图里,每个小方格区域被染上不同的颜色,求此图中的国家总数(上下左右不可斜对角)。
#include #include #include using namespace std;int resolution(vector > &A){ //self-defined construct struct Point { int line; int col; Point(int X, int Y) :
2016-05-16 20:11:00 560
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人