- 博客(161)
- 资源 (2)
- 收藏
- 关注
原创 norm函数-matlab
norm(X)会求出向量X的二范数,即等价于sqrt(sum(X.^2)); 即向量每个元素分别平方后求和再开方。格式:n=norm(A,p)功能:norm函数可计算几种不同类型的矩阵范数,根据p的不同可得到不同的范数1、如果A为矩阵 n=norm(A) 《Simulink与信号处理》返回A的最大奇异值,即max(svd(A))n=norm(A,p)根据p的不同,返回不同的值 p 返回值
2017-12-18 22:25:50 11704
原创 Victor and String
题目描述Victor loves to play with string. He thinks a string is charming as the string is a palindromic string. Victor wants to play $n$ times. Each time he will do one of following four operation
2017-12-18 11:26:25 12029
原创 Reincarnation
题目描述Now you are back,and have a task to do: Given you a string s consist of lower-case English letters only,denote f(s) as the number of distinct sub-string of s. And you have some query,each
2017-12-18 11:25:07 10879
原创 女友的考验
题目描述 终于放寒假了,小明要和女朋友一起去看电影。这天,女朋友想给小明一个考验,在小明正准备出发的时候,女朋友告诉他,她在电影院等他,小明过来的路线必须满足给定的规则: 1、假设小明在的位置是1号点,女朋友在的位置是n号点,则他们之间有n-2个点可以走,小明每次走的时候只能走到比当前所在点编号大的位置; 2、小明来的时候不能按一定的顺序经过某些地方。比如,如果女朋友告诉
2017-12-18 11:22:16 10962
原创 str2int
题目描述In this problem, you are given several strings that contain only digits from '0' to '9', inclusive. An example is shown below. 101 123 The set S of strings is consists of the N strings
2017-12-18 11:20:31 14048
原创 Good Article Good sentence
题目描述In middle school, teachers used to encourage us to pick up pretty sentences so that we could apply those sentences in our own articles. One of my classmates ZengXiao Xian, wanted to get senten
2017-12-18 11:19:16 11072
原创 Dynamic Lover
题目描述As a famous person with universal love, changing girlfriend too often makes me harassment because I can't keep their name in mind timely. To remember who is my lover now, I buy a magic passwor
2017-12-15 10:18:23 13964
原创 GRE Words
题目描述Recently George is preparing for the Graduate Record Examinations (GRE for short). Obviously the most important thing is reciting the words. Now George is working on a word list containing N
2017-12-15 10:14:01 11788
原创 Cyclic Nacklace
题目描述CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking abou
2017-12-15 10:06:33 11000
原创 Best Reward
题目描述After an uphill battle, General Li won a great victory. Now the head of state decide to reward him with honor and treasures for his great exploit. One of these treasures is a necklace made
2017-12-15 10:04:37 12635
原创 Boring counting
题目描述035 now faced a tough problem,his english teacher gives him a string,which consists with n lower case letter,he must figure out how many substrings appear at least twice,moreover,such apearanc
2017-12-15 09:59:35 12768
原创 Count the string
题目描述It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this string. For example:
2017-12-15 09:56:48 10885
原创 最长回文
题目描述给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度. 回文就是正反读都是一样的字符串,如aba, abba等输入描述:输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S 两组case之间由空行隔开(该空行不用处理) 字符串长度len 输出描述:每一行一个整数x,对
2017-12-15 09:52:19 11448
原创 病毒侵袭持续中
题目描述小t非常感谢大家帮忙解决了他的上一个问题。然而病毒侵袭持续中。在小t的不懈努力下,他发现了网路中的“万恶之源”。这是一个庞大的病毒网站,他有着好多好多的病毒,但是这个网站包含的病毒很奇怪,这些病毒的特征码很短,而且只包含“英文大写字符”。当然小t好想好想为民除害,但是小t从来不打没有准备的战争。知己知彼,百战不殆,小t首先要做的是知道这个病毒网站特征:包含多少不同的病毒,每种病毒出
2017-12-15 09:49:39 12445
原创 Wireless Password
题目描述Liyuan lives in a old apartment. One day, he suddenly found that there was a wireless network in the building. Liyuan did not know the password of the network, but he got some important inform
2017-12-15 09:47:58 11705
原创 考研路茫茫――单词情结
背单词,始终是复习英语的重要环节。在荒废了3年大学生涯后,Lele也终于要开始背单词了。 一天,Lele在某本单词书上看到了一个根据词根来背单词的方法。比如"ab",放在单词前一般表示"相反,变坏,离去"等。 于是Lele想,如果背了N个词根,那这些词根到底会不会在单词里出现呢。更确切的描述是:长度不超过L,只由小写字母组成的,至少包含一个词根的单词,一共可能有多少个呢?这里就不考虑单
2017-12-15 09:44:49 10945
原创 Keywords Search
In the modern time, Search engine came into the life of everybody likeGoogle, Baidu, etc.Wiskey also wants to bring this feature to his image retrieval system. Every image have a long descriptio
2017-12-06 09:14:28 12921
原创 魔咒字典
哈利波特在魔法学校的必修课之一就是学习魔咒。据说魔法世界有100000种不同的魔咒,哈利很难全部记住,但是为了对抗强敌,他必须在危急时刻能够调用任何一个需要的魔咒,所以他需要你的帮助。 给你一部魔咒词典。当哈利听到一个魔咒时,你的程序必须告诉他那个魔咒的功能;当哈利需要某个功能但不知道该用什么魔咒时,你的程序要替他找到相应的魔咒。如果他要的魔咒不在词典中,就输出“what?” 输入
2017-12-06 09:08:56 12361
原创 Number Sequence
Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1],b[2], ...... , b[M] (1 Your task is to find a number K which make a[K] = b[1], a[K + 1] = b[2],...... , a[K + M - 1] = b[M]. If the
2017-12-06 08:49:11 11618
原创 Matlab--intersect
intersect函数用法如下:[c, ia, ib] = intersect(A, B);这个函数是c返回A B的交集,ia,ib返回的是 交集 所在 数组的指标。例:A=[2 3 4]; B=[4]; [c, ia, ib] = intersect(A, B);得到 c=[4] c在数组A的指标为ia=3 c在数组B的指标为ib
2017-12-02 10:00:45 39842
原创 Oulipo
题目描述The French author Georges Perec (1936�1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, m
2017-11-30 09:18:56 17180
原创 Nested Dolls
题目描述Dilworth is the world’s most prominent collector of Russian nested dolls: he literally has thousands of them! You know, the wooden hollow dolls of different sizes of which the smallest doll is
2017-11-30 09:16:43 24455 1
原创 Equations
题目描述Consider equations having the following form: a*x1^2+b*x2^2+c*x3^2+d*x4^2=0 a, b, c, d are integers from the interval [-50,50] and any of them cannot be 0. It is consider a solution
2017-11-30 09:15:08 16119
原创 Longest Common Substring
题目描述Given two strings, you have to tell the length of the Longest Common Substring of them. For example: str1 = banana str2 = cianaic So the Longest Common Substring is "ana", and the
2017-11-30 09:13:48 28619
原创 Period
题目描述For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for ea
2017-11-30 09:12:10 30613
原创 全文检索
题目描述我们大家经常用google检索信息,但是检索信息的程序是很困难编写的;现在请你编写一个简单的全文检索程序。 问题的描述是这样的:给定一个信息流文件,信息完全有数字组成,数字个数不超过60000个,但也不少于60个;再给定一个关键字集合,其中关键字个数不超过10000个,每个关键字的信息数字不超过60个,但也不少于5个;两个不同的关键字的前4个数字是不相同的;由于流文件太长,已经
2017-11-30 09:10:29 29137
原创 统计难题
题目描述Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). 输入描述:输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都
2017-11-30 09:05:31 12290
原创 最大连续子序列
给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{ 11, -4, 13 },最大和 为20。 在今年的数据结构考卷中,要求编写程序得到最大和,现在增加一个要求,即还需要输出该 子序列的第一个和最后一个元素。
2017-11-30 09:02:31 12057
原创 Common Sequence
A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exists a strictly incr
2017-11-30 08:59:51 12732
原创 Max Num
Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14. The fi
2017-11-30 08:56:29 13723
原创 是男人就下100层
相信大家都听说过“是男人就下100层”系列游戏,游戏中包括多个长度和高度各不相同的平台,地面是最低的平台,高度为零,长度无限。一个男人在开始的时候从高于所有平台的某处开始下落,它的下落速度始终为1米/秒。当他落到某个平台上时,游戏者选择让他向左或向右跑,跑动的速度也是1米/秒。当他跑到平台的边缘时会继续下落。要求每次下落的高度不能超过MAX米,不然就会摔死,游戏也会结束。请帮忙设计一个程序
2017-11-29 21:23:16 15158 1
原创 把二叉树打印成多行
从上到下按层打印二叉树,同一层结点从左至右输出。每一层输出一行。import java.util.ArrayList;import java.util.LinkedList;class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(
2017-11-27 09:15:22 14547
原创 二叉树的镜像(对称的二叉树)
操作给定的二叉树,将其变换为源二叉树的镜像。 输入描述:二叉树的镜像定义:源二叉树 8 / \ 6 10 / \ / \ 5 7 9 11 镜像二叉树 8 / \ 10 6 / \ / \ 11 9 7 5/
2017-11-27 09:14:12 14855
原创 二叉树的下一个节点
给定一个二叉树和其中的一个结点,请找出中序遍历顺序的下一个结点并且返回。注意,树中的结点不仅包含左右子结点,同时包含指向父结点的指针。/*public class TreeLinkNode { int val; TreeLinkNode left = null; TreeLinkNode right = null; TreeLinkNode next = nu
2017-11-27 09:13:12 14697
原创 删除链表中重复的节点
在一个排序的链表中,存在重复的结点,请删除该链表中重复的结点,重复的结点不保留,返回链表头指针。 例如,链表1->2->3->3->4->4->5 处理后为 1->2->5/* public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val =
2017-11-27 09:11:57 12901
原创 链表中环的入口结点
一个链表中包含环,请找出该链表的环的入口结点。/* public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; }}*/public class Solution { //分成两步:1.判断是否存在环,并找
2017-11-27 09:11:03 11190
原创 字符流中第一个不重复的字符
请实现一个函数用来找出字符流中第一个只出现一次的字符。例如,当从字符流中只读出前两个字符"go"时,第一个只出现一次的字符是"g"。当从该字符流中读出前六个字符“google"时,第一个只出现一次的字符是"l"。 输出描述:如果当前字符流没有存在出现一次的字符,返回#字符。思路:定义一个数据容器来保存字符在字符流中的位置,当一个字符第一次从字符流中读出来时,把它在字符流中的位置
2017-11-27 09:07:51 11759
原创 表示数值的字符串
请实现一个函数用来判断字符串是否表示数值(包括整数和小数)。例如,字符串"+100","5e2","-123","3.1416"和"-1E-16"都表示数值。 但是"12e","1a3.14","1.2.3","+-5"和"12e+4.3"都不是。思路:使用正则表达式来解决public class Solution { public boolean isNumeric(ch
2017-11-27 09:06:30 10896
原创 正则表达式匹配
请实现一个函数用来匹配包括'.'和'*'的正则表达式。模式中的字符'.'表示任意一个字符,而'*'表示它前面的字符可以出现任意次(包含0次)。 在本题中,匹配是指字符串的所有字符匹配整个模式。例如,字符串"aaa"与模式"a.a"和"ab*ac*a"匹配,但是与"aa.a"和"ab*a"均不匹配public class Solution { public boolean match(c
2017-11-27 09:04:31 12121
原创 构建乘积数组
给定一个数组A[0,1,...,n-1],请构建一个数组B[0,1,...,n-1],其中B中的元素B[i]=A[0]*A[1]*...*A[i-1]*A[i+1]*...*A[n-1]。不能使用除法。import java.util.ArrayList;public class Solution { public int[] multiply(int[] A) {
2017-11-27 08:59:32 11973
怎样将java程序打成exe文件运行在无java环境的机器上-图文详解
2017-10-28
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人