07 2013 档案

HDU 3415 单调队列
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 #define max 100000+10 6 7 int a[max],sum[(max q;10 11 void inq(int i){12 while(!q.empt... 阅读全文

posted @ 2013-07-31 16:27 Stomach_ache 阅读(129) 评论(0) 推荐(0) 编辑

Ubuntu下安装Libpcap
摘要:Libpcap是 Unix/Linux 平台下的网络数据捕获函数包,百度百科是这么说的,唉,不管什么来头,只要帮我完成作业就行,安装过程记录如下:还是那个套路,先在网上搜了一把,大概也就那样,被疯狂转载的方法。首先安装gcc编译器,这个早就装好了,然后由于Libpcap有一些依赖包,所以在安装Li... 阅读全文

posted @ 2013-07-26 10:38 Stomach_ache 阅读(444) 评论(0) 推荐(0) 编辑

Hamming Codes
摘要:/*ID: weitong4LANG: C++TASK: hamming*/#include#include#define max 64int ans[max+5];int N,B,D;bool ham_dis(int x,int y){ int cnt=0; for(int i=0;i>=1; ... 阅读全文

posted @ 2013-07-25 21:05 Stomach_ache 阅读(187) 评论(0) 推荐(0) 编辑

poj 2115 扩展欧几里德
摘要:1 #include 2 #include 3 #define max 32 4 5 typedef long long LL; 6 LL pow2[max+5]; 7 8 void init(){ 9 for(int i=1;i<=max;i++){10 pow2[i... 阅读全文

posted @ 2013-07-25 20:03 Stomach_ache 阅读(145) 评论(0) 推荐(0) 编辑

ubuntu查看并杀死进程
摘要:Ubuntu 查看和杀死进程今天在netbeans中关闭webrick时,发现没有关闭掉,打入localhost:3000 依然显示页面,发现无法从nb中再次关闭只有进入ubuntu的进程下关闭查看进程:1,ps -e 命令 2,feng@feng:~$ sudo netstat -antupAct... 阅读全文

posted @ 2013-07-25 16:53 Stomach_ache 阅读(280) 评论(0) 推荐(0) 编辑

USACO 2.1.4
摘要:1 /* 2 ID: weitong4 3 LANG: C++ 4 TASK: holstein 5 */ 6 #include 7 #include 8 #define v_max 25+5 9 #define g_max 15+510 11 int v,g;12 int a[v_max],b[... 阅读全文

posted @ 2013-07-25 13:50 Stomach_ache 阅读(116) 评论(0) 推荐(0) 编辑

freopen() 函数的使用
摘要:当我们求解acm题目时,通常在设计好算法和程序后,要在调试环境(例如VC等)中运行程序,输入测试数据,当能得到正确运行结果后,才将程序提交到oj中。但由于调试往往不能一次成功,每次运行时,都要重新输入一遍测试数据,对于有大量输入数据的题目,输入数据需要花费大量时间。 使用freope... 阅读全文

posted @ 2013-07-22 19:43 Stomach_ache 阅读(217) 评论(0) 推荐(0) 编辑

hdu1520 树形DP
摘要:1 /* 2 * 树形DP 3 */ 4 #include 5 #include 6 #include 7 using namespace std; 8 #define Max(x,y) (x>y?x:y) 9 #define max 6000+1010 11 //dp[i][0],dp[i]... 阅读全文

posted @ 2013-07-20 13:54 Stomach_ache 阅读(114) 评论(0) 推荐(0) 编辑

UVa 10131
摘要:1 /* 2 3 * 类似于最长递减子序列 4 */ 5 #include 6 7 #include 8 #include 9 using namespace std;10 #define Max(x,y) (x>y?x:y)11 #define max 1000+512 struct nod... 阅读全文

posted @ 2013-07-18 19:43 Stomach_ache 阅读(120) 评论(0) 推荐(0) 编辑

UVa 562
摘要:1 /* 2 3 * 泥马,WA了一天,这题应该是很简单的DP,不过就是做不出来,只好改用母函数。。。。。 4 */ 5 #include 6 7 #include 8 #include 9 #include10 using namespace std;11 #define max 100+5... 阅读全文

posted @ 2013-07-18 19:42 Stomach_ache 阅读(139) 评论(0) 推荐(0) 编辑

poj2109
摘要:题目链接: http://poj.org/problem?id=2109代码很简单,但是还是学到了东西。。类型 长度 (bit) 有效数字 绝对值范围float 32 6~7 10^(-37) ~ 10^38double 64 15~16 10^(-307) ~10^308long double ... 阅读全文

posted @ 2013-07-18 12:01 Stomach_ache 阅读(137) 评论(0) 推荐(0) 编辑

poj1160 动态规划
摘要:1 #include 2 #include 3 #define INF 999999999 4 #define Min(x,y) (x<y?x:y) 5 #define max 300+5 6 //dp[i][k]记录在从1到i的村庄中放置k个邮局的最短总距离 7 //sum[i][j]记录在从第... 阅读全文

posted @ 2013-07-15 14:49 Stomach_ache 阅读(131) 评论(0) 推荐(0) 编辑

zoj 1001 python起步
摘要:1 /*赶角还是挺好的。。。。*/2 import sys3 4 for line in sys.stdin:5 a=line.split()6 print int(a[0])+int(a[1]) 阅读全文

posted @ 2013-07-12 21:05 Stomach_ache 阅读(188) 评论(0) 推荐(0) 编辑

图的着色问题
摘要:问题起源于一个宣讲会时间安排问题,有若干个部门要进行宣讲会,有若干个同学对多个部门有兴趣,希望在给出一个时间方案,要求所有的同学都可以参加所有他感兴趣的宣讲会,同时要求在最短的时间内把宣讲会结束。把每个宣讲会作为一个点,每个同学感兴趣的宣讲会两两相连,就变成了一个图的最少着色问题。图的m-着色判定问... 阅读全文

posted @ 2013-07-12 17:20 Stomach_ache 阅读(1192) 评论(0) 推荐(0) 编辑

zoj2562 反素数
摘要:/*这题1 =a2>=a3>=............an.另外,如何求p的正约数个数呢,答案就是(a1+1)*(a2+1)*(a3+1)*..........(an=1)如:p=6=2^1*3^1,故6的约束个数为(1+1)*(1+1)=4 ......等等然后就是按照素因子递增的顺序逐个搜索,然... 阅读全文

posted @ 2013-07-11 15:30 Stomach_ache 阅读(220) 评论(0) 推荐(0) 编辑

The Zen of Python
摘要: 阅读全文

posted @ 2013-07-11 15:08 Stomach_ache 阅读(112) 评论(0) 推荐(0) 编辑

fill memset, for小测试
摘要:/*很无聊写着玩玩,后来发现memset效率会比fill高出这么多,可惜一般只用来赋值0,-1.。。。。。以后可以用fill来偷偷懒了。。。*/#include#includeusing namespace std;#define max 100000000+5int a[max];int main... 阅读全文

posted @ 2013-07-10 11:27 Stomach_ache 阅读(188) 评论(0) 推荐(0) 编辑

反素数
摘要:反素数问题描述:对于任何正整数x,起约数的个数记做g(x).例如g(1)=1,g(6)=4.定义:如果某个正整数x满足:对于任意i(0求约数最多的数如果求约数的个数 756=2^2*3^3*7^1(2+1)*(3+1)*(1+1)=24基于上述结论,给出算法:按照质因数大小递增顺序搜索每一个质因子,... 阅读全文

posted @ 2013-07-07 20:52 Stomach_ache 阅读(260) 评论(0) 推荐(0) 编辑

POJ1151 离散化求矩形面积的并
摘要:1 /*第一道离散化的题目,虽然是水题,不过还是很高兴。。。*/ 2 3 #include 4 #include 5 #include 6 using namespace std; 7 struct rect 8 { 9 double x1,x2,y1,y2;10 };11 #define m... 阅读全文

posted @ 2013-07-07 15:38 Stomach_ache 阅读(159) 评论(0) 推荐(0) 编辑

HDU3486 RMQ
摘要:1 /*多么变态的一道题,交了18次*/ 2 3 4 #include 5 #include 6 #include 7 #define max(a,b) (a>b?a:b) 8 int dp[200005][20],llog2[200005];//用llog2数组进行优化 9 int n,k;... 阅读全文

posted @ 2013-07-05 18:27 Stomach_ache 阅读(153) 评论(0) 推荐(0) 编辑

ACMer之歌
摘要:>死了都要编不动态规划不痛快算法多深只有这样才足够表白死了都要编不A星算法不痛快宇宙毁灭星还在把每天当成是比赛来编程一分一秒都编到汗水掉下来不理会别人是搜索或贪心只要你勇敢跟我编编不用刻意安排凭感觉去编程提交就会很愉快享受现在别一提交就怕WRONG ANSWER许多奇迹我们相信才会存在死了都要编不... 阅读全文

posted @ 2013-07-05 10:51 Stomach_ache 阅读(160) 评论(0) 推荐(0) 编辑

Codeforces 222B 数组行列交换操作
摘要:/*做完这题发现自己好水,太伤人了。。。。不过还是学到一些,如果直接暴力模拟的话肯定是TLM。。所以要用虚拟数组来分别保存当前数组的每行没列在初始数组中的位置。。。*/#include#includeusing namespace std;#define max 1000+5int a[max][m... 阅读全文

posted @ 2013-07-04 19:39 Stomach_ache 阅读(240) 评论(0) 推荐(0) 编辑

HDU1950
摘要://虽然是一道LIS问题,但是还是第一次用O(n*lgn)这种算法,赶角波错哈哈哈哈。。。。至少今天有所收获#include#include#define max 40000+5int a[max],dp[max];int main(){ int t; scanf("%d",&t); while(t... 阅读全文

posted @ 2013-07-02 14:30 Stomach_ache 阅读(138) 评论(0) 推荐(0) 编辑

NYoj536 矩阵链乘
摘要:经典问题没啥说的#include#include#define max 100+1#define min(a,b) (a<b?a:b)typedef long long LL;LL dp[max][max];int p[max];int main(){ int n; while(~scanf("%d... 阅读全文

posted @ 2013-07-01 14:50 Stomach_ache 阅读(117) 评论(0) 推荐(0) 编辑

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

导航

统计

点击右上角即可分享
微信分享提示