- 博客(25)
- 资源 (1)
- 收藏
- 关注
原创 no module named numpy
显然没有安装numpy模块。安装命令如下:sudo apt-get install python-numpy。
2016-04-18 20:59:26 2550
原创 jquery实现轮询
function showUnreadNews() { $(document).ready(function() { $.ajax({ type: "POST", url: "unread_list.php", dataType: "json",
2016-04-16 12:50:31 15824
原创 百炼OJ1009
描述IONU Satellite Imaging, Inc. records and stores very large images using run length encoding. You are to write a program that reads a compressed image, finds the edges in the image, as described be
2016-01-19 11:38:05 788
原创 百炼OJ1007
描述现在有一些长度相等的DNA串(只由ACGT四个字母组成),请将它们按照逆序对的数量多少排序。逆序对指的是字符串A中的两个字符A[i]、A[j],具有i A[j] 的性质。如字符串”ATCG“中,T和C是一个逆序对,T和G是另一个逆序对,这个字符串的逆序对数为2。输入第1行:两个整数n和m,n(0第2至m+1行:每行是一个长度为n的字符串输出按逆
2016-01-15 14:50:34 981
原创 百炼OJ1006
描述Some people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have peri
2016-01-15 14:35:57 442
原创 百炼OJ1005
描述Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by 50 squ
2016-01-15 14:34:30 572
原创 百炼OJ1004
描述Larry今年毕业并找到了一份工作。他赚很多钱,但似乎总是不够。Larry认为他需要控制他的投资以解决自己的财务问题。Larry拿到了自己的银行账户详单,想看看自己有多少钱。请帮助Larry写一个程序,通过过去12个月中每月的月末结余,计算平均结余。输入输入包含12行,每行包含一个数,为某个月的结余。每个数都是不大于1,000,000的正数,保留两位小数,省略"$"符。
2016-01-15 14:31:13 2751
原创 百炼OJ1003
描述How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must be perpendicular to the
2016-01-14 12:41:07 477
原创 百炼OJ1002
描述英文字母(除Q和Z外)和电话号码存在着对应关系,如下所示:A,B,C -> 2D,E,F -> 3G,H,I -> 4J,K,L -> 5M,N,O -> 6P,R,S -> 7T,U,V -> 8W,X,Y -> 9标准的电话号码格式是xxx-xxxx,其中x表示0-9中的一个数字。有时为了方便记忆电话号码,我们
2016-01-14 00:09:43 586
原创 百炼OJ1001
描述Problems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many computer sy
2016-01-13 19:13:46 645
原创 Java中的equals与==之比较
Java中的==的主要功能:①比较基本数据类型,如果二者值相同则返回true否则返回false②用于比较引用,如果引用指向内存中的同一对象,返回true否则返回false。 equals方法本意是确定两个对象的引用是否相同。 下面看一段测试程序: static class Value { int i; } /** * @para
2015-01-13 17:35:03 433
原创 编程珠玑第二版第八章习题(Java)
1 书上说要参考某论文,不明觉厉。3 这个大概是个数列求和,没啥可说的。4 每一个数字都是[-1,1]之间随机取的一个数字,服从均匀分布,假设这个数组足够大,那么每个数字都可能出现,为此可以推测最大子段和期望是1.5 cumarr声明成 float*cumarr,则赋值 cumarr=realarray+1;意味着cumarr[-1]指向realarray[0]。9 maxsofa
2015-01-12 10:06:57 717
转载 最长递增子序列 O(NlogN)算法
原博客地址:http://www.felix021.com/blog/tb.php?t=1587&extra=f46f2今天回顾WOJ1398,发现了这个当时没有理解透彻的算法。看了好久好久,现在终于想明白了。试着把它写下来,让自己更明白。最长递增子序列,Longest Increasing Subsequence 下面我们简记为 LIS。排序+LCS算法 以及 DP算法就
2015-01-10 09:50:15 451
转载 动态规划:从新手到专家
作者:Hawstein出处:http://hawstein.com/posts/dp-novice-to-advanced.html声明:本文采用以下协议进行授权: 自由转载-非商用-非衍生-保持署名|Creative Commons BY-NC-ND 3.0 ,转载请注明作者及出处。前言本文翻译自TopCoder上的一篇文章: Dynamic Programmin
2015-01-09 20:40:11 482
原创 编程珠玑第二版第六章习题(Java)
这一章的程序性能分析通常在数据结构第一张就会讲到。3 写个程序测试一下public class TimeTest { public static void main(String[] args) { // TODO 自动生成的方法存根 long time1, time2, time3, time4; float a = 0; double b = 0; float x
2015-01-08 09:43:43 1224
原创 编程珠玑第二版第五章习题(Java)
1 (此段内容来自原书,在此向原作者表示感谢)When I write large programs, I use long names (ten or twenty characters) for my global variables. This column uses short variable names such as x, n and t. In most software proj
2015-01-07 10:43:34 1056
原创 对二分查找程序的一次测试
本文内容来源于《编程珠玑》第二版5.2节。 先看一段程序: public class ErrirBinary { static int array[] = new int[] { 0, 1, 2, 3, 4 }; public static int BinarySearch(int number) { int start = 0, middle, end
2015-01-07 09:58:47 640
原创 编程珠玑第二版第四章习题(Java)
>1 初始限定 上下限范围,下限不会变小,上限不会变大,保证不会越界。2 二分法改进,第一次找到指定数字后记录该位置,姑且叫他location,之后锲而不舍的向前二分寻找,因为找第一次出现,所以肯定不会往后找,直到start+1=end。这个时候返回location值。public class Number { static int[] array = new int[] { 1,
2015-01-06 16:44:05 676
原创 编程珠玑第二版第三章习题(Java)
1 定义三个数组,分别存储某一阶段收入起点,税率以及已有税收。代码:public class Tax { static float[] rate = new float[58];// 税率 static double[] start = new double[58];// 收入起点 static double[] tax = new double[58];// 已有税 pub
2015-01-06 14:51:21 783
原创 杂技算法Java实现
将一个n元一维向量向左旋转i个位置。例如,当n=8且i=3时,向量abcdefgh旋转为defghabc。简单的代码使用一个n元的中间向量在n步内完成该工作。你能否仅使用数十个额外字节的存储空间,在正比于n的时间内完成向量的旋转?(《编程珠玑》第二章)“移动x[0]到临时变量t,然后移动x[i]至x[0],x[2i]至x[i],依此类推(将x中的所有下标对n取模),直至返回到取x[0]中的元素
2015-01-03 13:27:36 516
原创 Android平台SQLite简单应用
作为一个完成的应用程序,数据存储操作是必不可少的。因此,Android系统一共提供了四种数据存储方式。分别是:SharePreference、SQLite、Content Provider和File。由于Android系统中,数据基本都是私有的的,都是存放于“data/data/程序包名”目录下,所以要实现数据共享,正确方式是使用Content Provider。 SQLite: SQL
2014-09-17 11:52:25 501
转载 解决openfire在使用MySQL数据库后的中文乱码问题(转)
openfire是一个非常不错的IM服务器,而且是纯Java实现,具有多个平台的版本,他的数据存储可以采用多种数据库,如MySQL,Oracle等。在实际使用时大家遇到最多的就是采用MySQL数据库后的中文乱码问题,这个问题十分有趣,而且从现象上可以看出openfire内部的一些机制。实际问题是这样的:首先启动openfire服务器,然后利用客户端或直接登录到后台新建一个帐户,为该帐户指定
2014-09-12 01:41:30 418
转载 java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.wid
转载的别人的,原博客地址:http://blog.csdn.net/lilu_leo/article/details/11952717
2014-08-06 16:31:25 860
原创 EditText cannot cast to ViewGroup
遇见了这个错误,logcat说java中出错的代码为:setContentView(R.layout.activity_register);
2014-08-02 20:08:06 723
原创 Fragment中使用listview
昨天按照在activity中的方法使用listview结果一直报错,今天参考了某高人博客后发现fragment中使用listview和activity中是不一样的。(参考博客:http://qurtyy.blog.163.com/blog/static/574436812013112543231523/)在Fragment的布局中必须包含id "@android:i
2014-07-14 13:29:34 8826 5
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人