上一页 1 ··· 219 220 221 222 223 224 225 226 227 ··· 300 下一页
2013年8月12日

poj 1459 (最大流)

摘要: 最大流简单题,,这题重要的是知道了scanf("%s",str);sscanf(str,"(%d,%d)%d",&x,&y,&w);读入方式 #include#includeconst int N=210;const int inf=0x3fffffff;int dis[N],gap[N],head[N],num,start,end,ans,n,m;struct edge{ int st,ed,flow,next;}E[21000];struct node{ int x,y,w;}P[40000];void addedge(int 阅读全文
posted @ 2013-08-12 19:32 you Richer 阅读(221) 评论(0) 推荐(0)

Static block start new thread

摘要: Static block start new threadpublic class StaticThreadInit { static{ Threadt = newThread(){ public void run(){ System.out.println("run"); System.out.println(webSite); webSite = "test1"; System.out.println("exitrun"); } }; t.start(); try{ t.join(); }catch(Exception ex){ 阅读全文
posted @ 2013-08-12 19:30 you Richer 阅读(217) 评论(0) 推荐(0)

2013-08-12 周报

摘要: 1. objective-c中 -(void)和+(void)的不同。-(void)是实例方法,只有定义了这个类的实例,才能用实例调用这个方法。+(void)是类方法,用类名可以直接调用这个方法。例如:@interface ClassName- (void)printInstanceName;+ (void)printClassName;@end实例方法调用方法:ClassName *className = [[ClassName alloc] init];[className printInstanceName];[className release];类方法调用方法:[ClassName 阅读全文
posted @ 2013-08-12 19:28 you Richer 阅读(167) 评论(0) 推荐(0)

动态调用python类和函数

摘要: 类class test1(object): def __init__(self): print "i am test1"class test2(object): def __init__(self): print "i am test2"# method 1class_name = 'test1'eval(class_name)()# method 2def exec_class(name): name()exec_class(test2) 函数def show(): print 'I am show'def talk() 阅读全文
posted @ 2013-08-12 19:26 you Richer 阅读(329) 评论(0) 推荐(0)

(Android) ContentProvider 实例

摘要: ContentProvider 用于应用程序(Android Application)之间传递数据,包括Insert, update, delete, query。下面的例子是在两个应用之间传递数据。应用一(创建ContentProviderTestA)TestContentProvider.javapublic class TestContentProvider extends ContentProvider {private final static UriMatcher URI_MATCHER; private final static int ALL_MESSAGES = 1; pri 阅读全文
posted @ 2013-08-12 19:23 you Richer 阅读(446) 评论(0) 推荐(0)

ArrayList和LinkedList的各项操作性能比较

摘要: 如果用java编写程序,我们通常存储易变的数据集合时用到的数据结构往往是ArrayList,不过,在JDK中还存在另一个结构--LinkedList,只不过我们通常不用,原因在于性能问题,下面,我就以一个问题来分析下这两个结构的性能差别。问题:自己编写一个测试程序,测试验证ArrayList和LinkedList在做增、删、改、遍历等操作上的性能差异。首先,我先给出ArrayList的测试类:package com.brucezhang.arraylinkedtest;import java.util.ArrayList;public class My_ArrayList_Test { ... 阅读全文
posted @ 2013-08-12 19:21 you Richer 阅读(244) 评论(0) 推荐(0)

根据字符串动态调用对象的方法

摘要: class test(object): def show(self): print 'I am show' def talk(self): print 'I am talk'method = 'show'getattr(test(), method)() 阅读全文
posted @ 2013-08-12 19:18 you Richer 阅读(146) 评论(0) 推荐(0)

随手写了一个linux服务端与window客户端的epoll程序,当做练习把。

摘要: linux服务端:监听链接,处理消息#include #include #include #include #include #include #include #include #define MAX_EVENTS 500 int main() { int epfd = -1; int listensocket; struct sockaddr_in serveraddr; char buf[MAX_EVENTS][100] = {0}; int nCount = 0; struct epoll_event ev, evs[MA... 阅读全文
posted @ 2013-08-12 19:16 you Richer 阅读(330) 评论(0) 推荐(0)

ural 1057(数位dp)

摘要: 数位dp题,关键是用树的思维去考虑。对于一个数字X,要是能表示成K个B的不同次幂,等价于X在B进制下有且只有K个位上面的数字为一,其他位上的数字都为0。具体读者可以去参考,国家集训队李聪的论文,里面的介绍都很详细。#include#include#define LL long longLL c[60][60];int K,b,a[40];void init()//预处理组合数{ int i,j; for(i=0;i=0;i--){//对于非二进制的处理 if(a[i]>1){ for(j=i;j>=0;j--)a[j]=1; ... 阅读全文
posted @ 2013-08-12 19:14 you Richer 阅读(200) 评论(0) 推荐(0)

OpenGL中glRotatef()函数究竟对矩阵做了什么

摘要: OpenGL中glRotatef()函数究竟对矩阵做了什么 我们知道OpenGL中维持着两套矩阵,一个是模型视图矩阵(model view matrix),另一个是投影矩阵(projection matrix)。而Direct3D维持着三个矩阵,其实它们的本质是一样的,因为Model(World)矩阵×View矩阵 = ModelView矩阵,也就是OpenGL的模型视图矩阵。通过对OpenGL这两套矩阵的变换,我们可以得到各种投影效果。这回我就来研究OpenGL中一个常见的函数glRotatef(d)。 看参数,glRotatef( angle, x, y, z )函数的作用是将. 阅读全文
posted @ 2013-08-12 19:12 you Richer 阅读(828) 评论(0) 推荐(0)
上一页 1 ··· 219 220 221 222 223 224 225 226 227 ··· 300 下一页