摘要: Dijkstra算法 说明:求解从起点到任意点的最短距离,注意该算法应用于没有负边的图。 来,看图。 用邻接矩阵表示 备注:第一行(从第零行开始)表示A,第一列(从第零列开始)表示A。m[1][2]表示A到B的距离,如果没有相连则赋值为0。 首先用dist[i]数组表示从起点到该点的距离,比如dis 阅读全文
posted @ 2017-12-21 21:40 lateral 阅读(1003) 评论(0) 推荐(0) 编辑
摘要: 昨天由于想用旧版本的Android Studio,然后装上后出了一个问题,搜到了Stackoverflow,提示删除了.gradle,然后我就把C:\Users\XXX\.gradle删了,没错,就是删了,真正的折腾从这里才开始,多次重装无果,然后找了别人的.gradle文件复制过来,还是老是提示g 阅读全文
posted @ 2017-03-21 16:25 lateral 阅读(1579) 评论(0) 推荐(0) 编辑
摘要: 算法简介:广度优先搜索 问题 给定一个一幅图和一个起点s,回答“从s到给定的顶点v是否存在一条路径?如果有,找出其中最短的那条(所含边数最少)。“ 思路 边数最少,很自然想到从从经过1条边能到达的节点有哪些?然后经过这些边再到达的节点有哪些?这样我不就能够想出来最短的路径了吗?没错,这是非常简单的想 阅读全文
posted @ 2016-11-02 11:26 lateral 阅读(21408) 评论(3) 推荐(3) 编辑
摘要: For a positive integer N , the digit sum of N is defined as the sum of N itself and its digits. When M is the digitsum of N , we call N a generator of 阅读全文
posted @ 2016-08-29 09:22 lateral 阅读(302) 评论(0) 推荐(0) 编辑
摘要: An organic compound is any member of a large class of chemical compounds whose molecules contain carbon. The molar mass of an organic compound is the 阅读全文
posted @ 2016-08-29 09:21 lateral 阅读(307) 评论(0) 推荐(0) 编辑
摘要: You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Be 阅读全文
posted @ 2016-08-29 09:19 lateral 阅读(226) 评论(0) 推荐(0) 编辑
摘要: Trung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequence of consecutive integers starting with 1 to N <t 阅读全文
posted @ 2016-05-09 21:07 lateral 阅读(261) 评论(0) 推荐(0) 编辑
摘要: There is an objective test result such as ``OOXXOXXOOO". An `O' means a correct answer of a problem and an `X' means a wrong answer. The score of each 阅读全文
posted @ 2016-05-09 20:26 lateral 阅读(476) 评论(0) 推荐(0) 编辑
摘要: 前言 这几天学习了队列,于是尝试了一下Joseph Problem,然后一直有一个地方没有通过,终于经点拨后,通过了。对于队列的使用还是加深了印象。建议如果队列的练手可以去尝试解决这个问题。 正文 Joseph Problem(35分) 铺垫: 假设有N个人围成一圈,然后第一个人把第二个人杀了,刀子 阅读全文
posted @ 2016-03-06 14:29 lateral 阅读(425) 评论(0) 推荐(0) 编辑
摘要: 前言 今天遇到求逆序对的问题,经过一番思索之后,特意来总结一下。因为也学习到了很多方法,以前自己一些百思不得其解的问题也有了解答。 正文 先上一个简单的问题: 分析:题目中说使用插入排序,也就是在排序过程中计算交换的次数,按照插入排序的原理,先定第一个,再定前两个的顺序,以此类推,只要交换了,我的次 阅读全文
posted @ 2016-02-25 12:41 lateral 阅读(2825) 评论(0) 推荐(2) 编辑