- 博客(57)
- 收藏
- 关注
原创 Android Selector用法
网上有很多这方面的资料,但都不能用。像下面这个: <item android:state_window_focused="false" android:drawable="@drawable/pic1" /> 原因是定义的顺序错了。Android控件的状态有很多
2015-05-28 21:34:49
510
原创 修改图片的MIME类型及使其名称排序的脚本
correctMIMEType模块:import os,sys,shelve,timedef correctMIMEType(): moduleFileName='correctMIMEType.py' fileTypeFile='fileType' mimeTypeFile='mime' countFile='.fileInfo' if not os.path.exis
2015-03-03 14:46:46
768
原创 hihoCoder之正则表达式
题目:时间限制:1000ms单点时限:1000ms内存限制:256MB描述给定一个字符串,判断其是否为合法的正则表达式。 一个正则表达式定义为: 1:0是正则表达式,1也是正则表达式。 2:P和Q都是正则表达式,则PQ是正则表达式。 3:P是正则表达式,则(P)是正则表达式 4:P是正则表达式,则P*也是正则表达式
2015-02-13 16:26:46
568
原创 Prim算法
本算法是对《算法导论》相关章节伪代码的实现:这是第一次写的:#include#include#include#includeusing namespace std;#define MAX 32767 ifstream fin("data.in");struct node{ node(int x1,int y1,int len1):x(x1),y(y1),len(
2015-01-04 15:38:28
615
原创 Fibonacci Heap实现
本算法是对<算法导论>相关章节伪代码的实现:先贴代码:#include#include#includeusing namespace std;class FibonacciHeap;class node{ friend class FibonacciHeap; node(int v):key(v),height(0),parent(NULL),left(this),righ
2015-01-02 08:40:02
792
原创 binomial heap实现
本算法是对<算法导论>相关章节的实现:下面贴代码:#include#includeusing namespace std;struct node{ node(int d):data(d),degree(0),parent(NULL),child(NULL),sibling(NULL){} int data; int degree; node* parent; node*
2014-12-30 18:38:05
1060
原创 Kruskal算法
算法导论第23章第2节#include#includeusing namespace std;struct node{ node(int i,int j,int l):x(i),y(j),len(l){} int x; int y; int len;};int N,M;int u,v,l;node* length[1000];int p[1000];int cnt
2014-12-28 15:28:21
645
原创 Floyd_Warshall Algorithm
本算法是对算法导论上相关章节伪代码的实现:#include#include#includeusing namespace std;#define MAX 32767ifstream fin("data.in");int N,M;int u,v,l;int D[1000][1000],p[1000][1000],tmpD[1000][1000],tmpP[1000][1000
2014-12-27 16:08:13
615
原创 Shortest paths and matrix multiplication
本算法是对<算法导论>第25章第一节的实现有三个版本:第一个,普通版本://SLOW-ALL-PAIRS-SHORTEST-PATHS#includeusing namespace std;#define MAX 32767int N,M;int u,v,l;int W[1000][1000],Q[1000][1000],tmp[1000][1000];void p
2014-12-26 16:19:48
606
原创 heapSort之应用
写了一个类库,有两个版本:版本一:#include#include#includeusing namespace std;template class Schedule{public: Schedule():cnt(0){} ~Schedule(){} type GetMax(); type ExtractMax(); void Insert(type); bo
2014-12-24 17:18:29
594
原创 Single-source shortest paths in directed graphs
此算法为<算法导论>中第24章第2小节关于single-source shortest paths in directed graphs原理的实现.原著P592#includeusing namespace std;#define MAX 32767int N,M;int u,v,l,pos;int w[1000][1000],d[1000];int order[1000]
2014-12-22 17:21:57
599
转载 elf_hash学习
#include#include#includeusing namespace std;unsigned long elf_hash(string str){ unsigned long h=0,g=0; string::iterator iter=str.begin(); while(iter!=str.end()) { h=(h<<4)+*iter; if((g=h
2014-12-20 15:58:36
581
原创 表达式树及其变体,以及我是如何借着个原理实现简易计算器的功能的
本题来源:《算法竞赛入门》第11章11.11.2本题给的解法:核心代码:int build_tree(string exp,int l,int r){ cout<<"l="<<l<<"\tr="<<r<<endl; int c1,c2,p,u; c1=-1; c2=-1; p=0; if(r-l<=1) { u=++cnt; chl[u]=chr[u]=0;
2014-12-11 18:46:55
684
原创 POJ 1600 Centipede Collisions
问题描述:DescriptionA small boy named Tommy has some toy centipedes that are a series of 1 centimeter segments. Tommy assembles his centipedes to any length he likes and places them on a 30x30 cen
2014-12-09 23:17:53
686
原创 POJ 1137----The New Villa
问题描述:The New VillaTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1354 Accepted: 443Description Mr. Black recently bought a villa in the countryside. Only one thing bothers him:
2014-12-05 17:35:29
741
原创 POJ 1825------Young
问题描述:DescriptionConsider m natural numbers n1, n2, ..., nm with the property n1 >= n2 >= ... >= nm > 0. We define a Young table as an arrangement in a table of n1 + n2 + ... + nm natural
2014-12-04 12:16:00
2558
原创 POJ 1508-------Skyscraper Floor
问题描述:Skyscraper FloorsTime Limit: 10000MS Memory Limit: 10000KTotal Submissions: 810 Accepted: 175Description What a great idea it is to build skyscrapers! Using not too large area of la
2014-12-03 23:35:01
784
原创 POJ1323------Game Prediction
问题描述:Game PredictionTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 9680 Accepted: 4626DescriptionSuppose there are M people, including you, playing a special card game. At the
2014-12-03 23:23:48
625
原创 POJ1400——Complicated Expressions
问题描述:Complicated ExpressionsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1503 Accepted: 485Description The most important activity of ACM is the GSM network. As the mobile pho
2014-12-01 19:20:26
737
原创 POJ1081--You Who?
You Who?Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 702Accepted: 249Description On the first day of first grade at Friendly Elementrary School, it is customary for each student
2014-11-29 12:05:00
911
原创 POJ1100---Dreisam Equations
问题描述:Dreisam EquationsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2060 Accepted: 418DescriptionDuring excavations in the Dreisamwuste, a desert on some far away and probabl
2014-11-26 16:23:39
1165
原创 POJ-1211Traffic Lights
DescriptionOne way of achieving a smooth and economical drive to work is to `catch' every traffic light, that is have every signal change to green as you approach it. One day you notice as you com
2014-11-25 18:30:22
973
原创 今天一个也没写出来
给两个链接这个没写出来http://www.cnblogs.com/scau20110726/archive/2012/12/21/2828420.html这个写的不好http://blog.youkuaiyun.com/mobius_strip/article/details/40506089
2014-11-23 16:46:55
517
原创 UVA10791----Minimum Sum LCM
问题描述:LCM (Least Common Multiple) of a set of integers is defined as the minimum number, which is a multiple of all integers of that set. It is interesting to note that any positive integer can be
2014-11-22 16:44:46
525
原创 UVA10673---Play With Floor And Ceil
问题描述:Problem APlay with Floor and CeilInput: standard inputOutput: standard outputTime Limit: 1 second TheoremFor any two integers x and k there exists two more integers p and q such
2014-11-22 13:18:42
528
原创 UVA10006----CarmichaelNumbers
问题描述:An important topic nowadays in computer science is cryptography. Some people even think that cryptography is the only important field in computer science, and that life would not matter at all
2014-11-22 12:04:19
514
转载 UVA138---StreetNumber
问题描述:A computer programmer lives in a street with houses numbered consecutively (from 1) down one side of the street. Every evening she walks her dog by leaving her house and randomly turning left
2014-11-22 10:34:42
533
原创 Jugs
UVA 571 Jugs问题描述:In the movie ``Die Hard 3", Bruce Willis and Samuel L. Jackson were confronted with the following puzzle. They were given a 3-gallon jug and a 5-gallon jug and were asked to fil
2014-11-21 20:28:24
903
原创 百度的新大厦
J:百度的新大厦 时间限制: 1000ms 内存限制: 65536kB 描述 继百度搜索框大厦之后,百度又于2012年初在深圳奠基了新的百度国际大厦,作为未来百度国际化的桥头堡。不同于百度在北京的搜索框大厦,新的百度国际大厦是一栋高楼,有非常多的楼层,让每个楼中的电梯都能到达所有楼层将是一个极为不明智的设计。因此,设计师给出了一个特别的设计——一共大厦有m个电梯,每个电梯只有两个按钮,
2014-11-17 18:56:42
814
转载 Stacking Boxes
UVA 103 问题描述 Stacking Boxes BackgroundSome concepts in Mathematics and Computer Science are simple in one or two dimensions but become more complex when extended to arbi
2014-11-16 13:47:50
593
转载 Coins Change
UVA 674问题描述Suppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want to make changes with these coins for a given amount of money.For example, if we have 1
2014-11-16 09:45:05
789
原创 Cutting Sticks
You have to cut a wood stick into pieces. The most affordable company, The Analog Cutting Machinery, Inc. (ACM), charges money according to the length of the stick being cut. Their procedure of work r
2014-11-16 08:55:17
530
原创 Twin Towers
Problem BThe Twin TowersInput: standard inputOutput: standard output Once upon a time, in an ancient Empire, there were two towers of dissimilar shapes in two different cities. The towers we
2014-11-15 18:59:24
709
原创 Longest Run On A Snowboard
题目:UVA 10285 Longest Run On A SnowboardLongest Run on a SnowboardInput: standard inputOutput: standard outputTime Limit: 5 secondsMemory Limit: 32 MB Michael likes snowboarding. That's
2014-11-15 10:27:55
635
原创 树的最大独立集
#include#include#includeusing namespace std;ifstream fin("C:\\data19.in");struct node{ node(int n=0):data(n),c(0),gc(1),parent(NULL),left(NULL),right(NULL){} int data; int c; int gc; stru
2014-11-14 11:23:40
894
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人