Loading

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 24 下一页
摘要: 题目代码class Solution {public: int singleNumber(vector& nums) { int temp=0; for(auto i:nums) { temp^=i; ... 阅读全文
posted @ 2018-09-13 11:01 李正浩 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 题目 代码class Solution {public: bool containsDuplicate(vector& nums) { std::map dic; for(auto i:nums) { di... 阅读全文
posted @ 2018-09-13 10:57 李正浩 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 题目 代码class Solution {public: void rotate(vector& nums, int k) { if(nums.size()==0||nums.size()==1) return; if(... 阅读全文
posted @ 2018-09-13 10:55 李正浩 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 题目 代码class Solution {public: int maxProfit(vector& prices) { //总的利润 int maxSalary=0; if(prices.size()==0) ... 阅读全文
posted @ 2018-09-13 10:52 李正浩 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 题目代码class Solution {public: int removeDuplicates(vector& nums) { if(nums.size()<=1) return nums.size(); int re... 阅读全文
posted @ 2018-09-13 10:46 李正浩 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 题目输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。思路1、算术移位与逻辑移位在计算机指令中,移位操作是一种基本操作,是一种直接对二进制数据的位运算操作。而移位运算又包含了逻辑移位(logical shift)和算术移位(arithmetic shift)两种... 阅读全文
posted @ 2018-09-02 19:47 李正浩 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 前言首先需要一款软件:Winhex,由于现在已经是2018年,大部分百度的软件都已经失效或者出现一堆bug,我费了九牛二虎之力才找到这个可用的,下面是下载地址:链接:https://pan.baidu.com/s/1rm0R8yO4TV5w9ji5I0EBDg 密码:3jmx... 阅读全文
posted @ 2018-08-04 12:08 李正浩 阅读(11688) 评论(0) 推荐(0) 编辑
摘要: //限制两个物体之间的距离if (Vector3.Distance(B.position, A.position) > maxDistance){ //获得两个物体之间的单位向量 Vector3 pos = (B.position - A.position).no... 阅读全文
posted @ 2018-08-01 13:49 李正浩 阅读(1396) 评论(0) 推荐(1) 编辑
摘要: 接着上一节:4、AI蛇的设计这里AI蛇大部分代码都可以参照主角的代码,我这里的实现其实还可以进行改进。基本原理就是蛇创建之后给蛇一个随机方向的单位向量,AI蛇的蛇头添加一个比蛇头大两三倍大小的碰撞检测盒,效果如图:当蛇头的碰撞检测盒子与墙壁或者其他蛇的身体碰撞时,给蛇一个反向... 阅读全文
posted @ 2018-07-30 15:47 李正浩 阅读(411) 评论(0) 推荐(0) 编辑
摘要: 游戏主界面: 由于这个场景比较复杂,需要分几个部分实现:1、游戏背景首先我们的游戏场景上包括了一个大的背景图片,之外再包围一个红色的区域。中间的区域才是可活动的区域,周围通过碰撞检测盒来检测是否有蛇撞到了墙壁。2、食物生成食物生成通过一个单例脚本来实现,创建一个食物的内存池(... 阅读全文
posted @ 2018-07-30 15:37 李正浩 阅读(334) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 24 下一页