Hungry3

梦想到达塔顶的蜗牛

2013年11月28日

JTable 一个最好的例子

摘要: 装载自:http://www.oschina.net/code/snippet_54100_1230import java.awt.BorderLayout;import java.awt.Color;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.Vector;import javax.swing.DefaultCellEditor;import javax.swing.JButton;import javax.swing.JComboBox;import java 阅读全文

posted @ 2013-11-28 21:40 Hungry3 阅读(294) 评论(0) 推荐(0)

2013年11月15日

zoj 3429 Cube Simulation 不同层的循环是独立的,好神奇

摘要: #include#include#includeusing namespace std;const int maxn=1010;int x[maxn],y[maxn],z[maxn];int X,Y,Z;int main(){ char op[20]; int i,j,k,val,a,b,c; int x1,x2,y1,y2,z1,z2; int tx,ty,tz; while(scanf("%s",op)!=EOF) { if(op[2]=='L') { scanf("%d%d%d",&X,&Y,&Z); ... 阅读全文

posted @ 2013-11-15 23:06 Hungry3 阅读(199) 评论(0) 推荐(0)

poj 3667 Hotel 线段树+区间合并

摘要: #include#includeusing namespace std;#define lson l,m,rt=tol)return query(tol,lson); else if(sumL[rs]+sumR[ls]>=tol)return m-sumR[ls]+1; else return query(tol,rson);}int main(){ int n,m,op,tol,L,R,d; while(scanf("%d%d",&n,&m)!=EOF) { build(1,n,1); while(m--) ... 阅读全文

posted @ 2013-11-15 19:49 Hungry3 阅读(148) 评论(0) 推荐(0)

2013年11月14日

UVALive 3942 - Remember the Word 字典树+dp

摘要: 状态转移方程很容易想出,和背包思想有点像,难点在如何如何用字典树来搞dp,ps:原来在建stuct时初始化时可以节省不少时间的!!#include#includeusing namespace std;const int max_node=400100;const int modn=20071027;const int son_num=26;int ch[max_node][son_num];int val[max_node];int sz;int dp[300100];struct trie{ trie() { sz=1; memset(ch,0,si... 阅读全文

posted @ 2013-11-14 20:11 Hungry3 阅读(147) 评论(0) 推荐(0)

量变与质变

摘要: 今天哲学老师的一句“量变必然会引起质变,但量变又不仅仅是数量上的变化,例如石墨和金刚石,金刚石比石墨硬度更大,不是因为金刚石拥有更多的碳元素,而是因为碳元素结合的方式不同,所以量变也有结构上,形式上的巨变,这样的量变有时才是推动质变的根源”,令我大切大悟。 阅读全文

posted @ 2013-11-14 19:06 Hungry3 阅读(401) 评论(0) 推荐(0)

2013年11月12日

hdu 4777 Rabbit Kingdom 离线树状数组

摘要: #include#include#include#includeusing namespace std;const int maxn=200100;struct Q{ int l,r,id; bool operator hav[maxn],vt[maxn];int n,m;void getp(){ int cnt,i,j; cnt=0; memset(isp,true,sizeof(isp)); isp[0]=isp[1]=false; for(i=2;i1)hav[i].push_back(ti); }}int lowbit(int i){ ... 阅读全文

posted @ 2013-11-12 23:58 Hungry3 阅读(170) 评论(0) 推荐(0)

“自作自受”

摘要: 搞难题的感觉真痛苦,大半天下来就那么点感悟,不过还是挺爽的=、= 阅读全文

posted @ 2013-11-12 21:09 Hungry3 阅读(128) 评论(0) 推荐(0)

HDU 3065 病毒侵袭持续中 AC自动机

摘要: #include#include#include#include#include#includeusing namespace std;map hash;const int max_node=30000+10;const int son_num=200;int cnt[1010];class ACAutomaton{ private: int sz; int trie[max_node][son_num]; int val[max_node]; int fail[max_node]; public: void init() { sz... 阅读全文

posted @ 2013-11-12 00:25 Hungry3 阅读(142) 评论(0) 推荐(0)

2013年11月11日

hdu 2896 病毒侵袭 ac自动机

摘要: #include#include#include#include#includeusing namespace std;const int max_node=60005;const int son_num=130;vector se;class ACAutomaton{ private: int sz; int trie[max_node][son_num]; int val[max_node]; int fail[max_node]; public: void init() { sz=0; memset(trie,0... 阅读全文

posted @ 2013-11-11 23:55 Hungry3 阅读(132) 评论(0) 推荐(0)

hdu 2222 Keywords Search ac自动机

摘要: 单词会重复,算完顺带清0就行了#include#include#includeusing namespace std;const int son_num=26;const int max_node=250010;class ACAutomaton{ private: int sz; int trie[max_node][son_num]; int val[max_node]; int fail[max_node]; public: int idx(char c) { return c-'a'; } void init()... 阅读全文

posted @ 2013-11-11 15:23 Hungry3 阅读(147) 评论(0) 推荐(0)

导航