题目
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
方法
使用两个矩阵,分别记录每一行连续的1的个数以及每一列连续的1的个数。
public int maximalRec...
分类:
其他好文 时间:
2014-06-11 00:24:51
阅读次数:
343
上一篇文章主要介绍的图片文件的下载与显示,这一篇文章主要介绍如何根据网页的地址,获取网页源代码的获取
其实,网站源代码的获取比图片的下载与显示更加简单,只需要对之前的代码稍作修改即可
public class OtherActivity extends Activity {
private TextView tv;
private static final int LOAD_SU...
分类:
移动开发 时间:
2014-06-10 15:27:58
阅读次数:
274
两种思路,第一种思路是通过对Bitmap进行操作,将Bitmap的像素值get到一个int[]数组里,因为在android里Bitmap通常是ARGB8888格式,所以最高位就是A通道的值,对齐进行改变后再新建一个Bitmap即可。第二种思路是通过设置canvas的paint的透明度,然后通过canvas.drawBitmap()来改变View的透明度。具体代码如下:第一种思路:public st...
分类:
移动开发 时间:
2014-06-10 08:17:03
阅读次数:
280
优先级队列是容器的一种,可以向优先级队列中添加或取出数据,取出数据时只能取出最大的数或最小的数。而其他的一些容器比如队列和栈,取出的顺序跟插入的顺序是有关的。
优先级队列的接口如下:
public class MaxPQ> {
MaxPQ();
void insert(Key x);
Key popMax();
boolean isE...
程序代码(这段代码在vc6.0中不能编译通过,在VS中能编译通过)
#include
using namespace std;
template//类声明前加模板的声明
class Complex
{
public:
Complex( )
{
real=0;
imag=0;
}
...
分类:
其他好文 时间:
2014-06-10 08:02:29
阅读次数:
249
// 研究了半宿,终于弄清楚了
// 写了这段测试代码可以很好的演示效果
class CConvert
{
public:
CConvert(){m_nValue = 10;}
// 重载()运算符
int operator ()();
// 重载int强制类型转换
operator int();
prot...
分类:
其他好文 时间:
2014-06-10 07:04:24
阅读次数:
196
题目
Implement int sqrt(int x).
Compute and return the square root of x.
方法一
使用二分查找,注意int的边界问题,使用除法。
public int sqrt(int x) {
if (x <= 1) {
return x;
...
分类:
其他好文 时间:
2014-06-10 06:49:45
阅读次数:
274
1:创建一个web项目或者java项目
2:找到hibernate包lib目录下面的required下面的包把包放到lib目录下面,在导入buidler path里面
3:写java类,我写的java bean类,代码如下:
package org.hibernate.domain;
import java.util.Date;
public class Event {
privat...
分类:
系统相关 时间:
2014-06-10 06:45:05
阅读次数:
343
关联数组可以有两种操作:
插入一个关键字和对应的值
通过关键字查询与之对应的值
典型的应用有DNS查找。
接口
关联数组的接口如下:
public interface ST {
public Value get(Key key);
public void remove(Key key);
pub...
分类:
其他好文 时间:
2014-06-10 06:41:31
阅读次数:
215
import java.awt.*;
import javax.swing.*;
public class SimpleFrameTest {
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable(){ // 开一个线程
public void run() {
Simpl...
分类:
编程语言 时间:
2014-06-10 06:05:33
阅读次数:
566