- 博客(30)
- 资源 (13)
- 问答 (2)
- 收藏
- 关注
原创 用openGL做一个时钟动画
#include<stdlib.h>#include<glut.h>#include<gl\GLU.h>#include<gl\GL.h>#include<math.h>#include<stdio.h>#include<windows.h>float tite = 0.0f;const flo...
2019-12-16 20:15:07 2451
原创 unity查找被prefab引用中的重复资源
贴图,模型using System.Collections;using UnityEngine;using UnityEditor;using System.Security.Cryptography;using System;using System.IO;using System.Collections.Generic;public class ReportWindow:Ed...
2019-12-29 12:22:29 797 1
原创 Unity编辑器拓展Scene下播放动画
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;using System.Linq;[RequireComponent(typeof(Animator))] //这个脚本作用就是为了加载游戏模型上public class PlayAnimInS...
2019-12-28 14:17:00 1007
原创 Unity计算fps
在这里插入代码片`#if UNITY_EDITORpublic class ShowFps:MonoBehaviour{ public float updateInterval = .5f; int cnt = 0; string stringFps; float accum; private void Update() { ac...
2019-12-26 20:25:35 163
原创 Unity游戏开发中闭包的实际应用
写c#UI脚本的时候,会想到循环对多个按钮进行初始化,初始化监听的时候会添加委托事件,委托里会传递一个不同的参数,与i相关,此时形成一个闭包。这是正确的写法,点击不同的btn的时候打印出来的i是不一样的,因为不同的btn的函数外包不一样。但是如果少了外层一层函数的封包,所有的btn使用的都是start函数这个包那i值自然都是一样的是5了。...
2019-12-25 16:20:15 998
原创 01背包问题c++动态规划
01背包问题:典型的动态规划问题,每件物品只有一件,要么放入背包,要么不放入,限重量为m,不可拆分,求能装最大价值。#include<iostream>using namespace std;const int maxnum = 100;int c[maxnum][maxnum];int b[maxnum];int v[maxnum];int main() { in...
2019-12-25 15:10:21 503
原创 动态规划-最长公共子序列c++
#include<iostream>#include<cstring>const int maxnum = 100;int c[maxnum][maxnum];char s1[maxnum];char s2[maxnum];int len1, len2;using namespace std;void LCSL(){ for (int i = 1; i ...
2019-12-25 12:01:03 578
原创 会议问题贪心
n个会议,不同开始时间,结束时间,求一天最多能参加的会议数量是多少贪心策略:选择结束时间最快的会议参加,在结束时间相等的前提条件下选择开始时间最大的会议=>选择会议时长最短的参加。#include<iostream>#include<algorithm>const int maxnum = 100;using namespace std;struct Me...
2019-12-24 17:38:28 603
原创 阿里巴巴背包问题贪心算法
#include<iostream>#include<algorithm>using namespace std;//按性价比贪心策略typedef struct three { double w; //重量 double v; //价值 double p; //性价比 three(double wi, double vi, double pi) { ...
2019-12-24 11:07:29 284
原创 方程式题目解法c++
x+y+z = 303x+2y+z = 50两个方程如何用程序解出x,y,z 的解找到一个取值的变化范围根据代入法求解即求出来了。第2个#include<iostream>using namespace std;int main(){ int x, y, z;//cnt记录可行解个数 for (int x = 1; x < 10; x++) { y = 2...
2019-12-23 16:32:20 265
原创 基数排序c++实现
增加空间优化了桶内排序的过程,十进制例子就有十个桶,先个位排序一遍,再十位进桶到最高位时则是排好序的。int Maxbit(int A[], int n)//求待排序序列最大元素位数{ int maxvalue = A[0], digits = 0;//初始化最大元素为A[0],最大位数为0 for (int i = 1; i < n; i++) //找到序列中最大元素 if (...
2019-12-23 15:36:21 436
原创 堆排序c++实现
建立堆之后就是对堆的简单选择,不断的求出最大的那一个数#include<iostream>using namespace std;void Swap(int r[],int i, int j){ int t = r[i]; r[i] = r[j]; r[j] = t;}void Sink(int k,int n,int r[]){ while (2 * k+1 &...
2019-12-23 11:41:39 83
原创 快速排序c++
#include<iostream>using namespace std;int Partition2(int r[], int low, int high){ int i = low, j = high, pivot = r[low]; while (i < j) { while (i<j&&r[j]>pivot) j--; w...
2019-12-23 01:12:52 77
原创 合并排序c++实现
#include<iostream>using namespace std;void Merge(int r[], int low, int mid, int high){ int *B = new int[high - low + 1]; int i = low, j = mid + 1,k=0; while (i <= mid && j <...
2019-12-23 00:55:06 736
原创 折半插入排序c++实现
#include<iostream>using namespace std;void BSStraightInsertSort(int r[], int n){ //默认第一个元素是有序的 for (int i = 2; i < n; i++) { r[0] = r[i]; //哨兵 //后面的元素在前面的有序序列中找到插入位置,做n-1次插入,成功 /...
2019-12-22 21:48:03 416
原创 哈希表c++实现
哈希函数计算地址有冲突用探测函数获得新地址解决为什么哈希函数查找速度快,因为他是索引查找,最好o(1),别扯那个多没用的哈希函数计算地址这些东西。#include<iostream>using namespace std;const int maxnum = 15;int HT[maxnum]; //哈希地址表int HC[maxnum]; //计算单个地址的比较...
2019-12-22 10:07:16 402
原创 二叉查找树c++实现
#include<iostream>typedef struct BSTNode { int data; struct BSTNode* lchild; struct BSTNode* rchild;}*BSTree;using namespace std;void insert(BSTree& t,int e){ if (!t) { t = new B...
2019-12-21 11:51:35 83
原创 Prim和Kruskal性能比较
/*Prim 邻接表+优先队列优化Kruskal 邻接矩阵+并查级优化,因为Kruskal里没有需要遍历邻接边的操作,所以简单的用邻接矩阵结果保证:获得路径即可e因为要有生成树,原图必须是一条连通的路线,所以e>=n-1*/#include<iostream>#include<queue>#include<Windows.h>usin...
2019-12-20 17:16:31 724
原创 AOE关键路径-基于c++十字链表实现
AOE网,带权有向图,边表示活动,顶点表示事件,既有活动之间的先后制约关系,又有活动的消耗,从源点到汇点的带权路径长度最大的路径称为关键路径,其中的活动称为关键活动。#include<iostream>#include<stack>using namespace std;const int maxNum = 100;typedef struct arcNode...
2019-12-19 20:47:43 297
原创 AOV拓扑排序-基于十字链表实现
AOV:顶点:活动,弧:活动之间优先级判断AOV有向图网中有环,生成一个线性序列,满足i到j有一条路径,且序列中i一定在j的前面,i,j均为顶点。#include<iostream>#include<stack>using namespace std;const int maxNum = 100;typedef struct arcNode { //弧...
2019-12-19 15:13:04 293
原创 Kruskal算法c++实现
//集合避圈法,以边为主导,从某一条边出发#include<iostream>using namespace std;const int maxnum = 100;const int INF = 0x3F3F3F3F;typedef struct edge { int u; int v; int w; edge() { } edge(int ui, int v...
2019-12-19 11:21:46 341
原创 Prim最小生成树算法C++实现
时间:o(n2) 空间:o(n)集合避圈法,解决连通各个单位,费用最少的问题。选取一点加入S集合中,一次选取V-S离S集合最近的点,加入S中,知道V-S为空集,最小生成树完成。#include<iostream>using namespace std;const int maxnum = 100;const int INF = 0x3FFFFFFF;typedef s...
2019-12-18 19:55:47 616
原创 Dijkstra基于邻接表算法C++实现
为了解决单源最短路径问题,利用贪心算法,将顶点集合V划分为两部分,集合S和V-S,先求出以源点u邻接最短的一条路径,作为已确定顶点路径将顶点加入到S中,则S为已确定路径顶点集合,在V-S集合中更新与前面已确定点的邻接点若以新前驱路径距离更少,则更新,之后回到前面在V-S中找长度最短的路径顶点,加入S中,知道V-S中的集合为空。使用邻接表在更新邻接点路径长度的时候更加方便#include&...
2019-12-18 10:49:38 1540
原创 邻接多重表C++实现
邻接多重表是面向无向图的另一种链式存储结构,从边出发构建整个图,方便访问标记,删除边等操作,存储空间最少。易判断顶点之间的关系。#include<iostream>using namespace std;const int maxnum = 100;typedef struct edgeNode { int i; int j; struct edgeNode* il...
2019-12-17 18:26:34 573
原创 十字链表 c++实现
十字链表 c++实现十字链表面向有向图的另一种链表存储结构,包含了领接表和逆领接表的特性,可以快速的访问出弧和入弧,得到出度和入度。#include<iostream>using namespace std;const int maxNum = 100;typedef struct arcNode { //弧结点类型 int tail; //弧尾下标 in...
2019-12-17 15:49:21 537
原创 递归回溯-求全排列LUA实现
function Arrange(a,n) n = n or #a if n<=1 then printResult(a) return end for i = 1, n do a[i],a[n] = a[n],a[i] Arrange(a,n-1) a[i],a[n] = a[...
2019-12-16 20:25:51 236
原创 LUA程序设计第4版第24章练习答案
f24.1 生产者设计驱动模式function producer() while true do local x = io.read() send(x) endendfunction consumer(x) print(x) while true do print(receive()) endend...
2019-12-16 20:06:05 157
原创 Lua程序设计第4版第20章练习答案
--f201local function intersact(a,b) for k,c in pairs(b) do a[k] = nil end return aendlocal function toS(set) local l = {} for _ in pairs(set) do l[#l+1] = tostr...
2019-12-15 18:15:55 168
原创 Lua程序设计第4版第18章练习答案
--18.1 18.2function fromto(n,m) local k = 0 return function() k = k+m return n[k] endendlocal n = {1,2,3}local m = 2for i in fromto(n,m) do if i ==nil then ...
2019-12-11 18:30:19 333
原创 Lua程序设计第12章练习答案
两个矩阵相加,稀疏还不会function f141(a,b) local c ={} for i = 1, #a do c[i] = {} for j = 1, #a[i] do c[i][j] = a[i][j]+b[i][j] end end for i = 1, #c do ...
2019-12-09 11:53:21 176
Unity 2018 Shaders and Effects Cookbook Third Edition
2018-07-18
Unity 2017 Game AI Programming Third Editon
2018-07-14
《Unity Shader》为什么
2022-01-09
Unity : 游戏内怎么获得一个模型的x,y,z的最大最小世界坐标点
2021-12-30
TA创建的收藏夹 TA关注的收藏夹
TA关注的人