LouZhang

导航

2012年8月1日

离散化 + unique + lower_bound的学习,hdu4325

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4325这题看了数据就会发现,数据都很小的。。。。所以直接暴力能过当然开始我用的线段树后来想到,既然离散化了,那来暴力试试吧所以当作学习吧,同时学习了unique这个函数了用unique之前最好先排序一开始我以为unique是去除所有相同元素,哪想到其实也是个排序罢了#include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int maxn = 100000 + 10;int a 阅读全文

posted @ 2012-08-01 22:41 louzhang_swk 阅读(549) 评论(0) 推荐(0) 编辑

最近整理的模板

摘要: dfs //http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3631 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int a[40]; int b[40]; int ans; int n, m; /* void dfs(int k, int sum) { if(ans == m)return; if(k == 0){ ans = max(sum, ans); ... 阅读全文

posted @ 2012-08-01 19:11 louzhang_swk 阅读(317) 评论(0) 推荐(0) 编辑

AOE网络,最长路关键路径的学习

摘要: 我只想说,被坑了总以为这本书上没有错。。。却出现了两个错误书上用的指针邻接表,我想学下数组模拟,然后就全改了一个点表示一个事件,一条边表示该活动的时间那么对于每个事件和每个活动都有最早可能开始时间和最迟允许开始时间了具体思路也不想写了,本想画个图来写篇博客。。浪费时间啊。。时间宝贵啊。。贴代码吧。。#include<cstdio>#include<cstring>const int maxn = 10000;//顶点个数最大值const int maxm = 10000;//边数最大值struct node{ int to, w, id;//边的另一个顶点,持续时间,活 阅读全文

posted @ 2012-08-01 11:43 louzhang_swk 阅读(1490) 评论(1) 推荐(0) 编辑

单调队列的学习

摘要: 前天CUG比赛的D题,也就是POJ3250题http://poj.org/problem?id=3250正好拿来学习了下单调队列了#include<cstdio>#include<cstring>const int maxn = 100000 + 10;int maxq[maxn];int ind[maxn];int q[maxn];int n;int a[maxn];long long ans = 0;void calc(){ int head = 1, tail = 0; for(int i = 1; i <= n; i ++){ while(head < 阅读全文

posted @ 2012-08-01 10:16 louzhang_swk 阅读(181) 评论(0) 推荐(0) 编辑

2012年7月31日

topsort模板,poj 2585

摘要: 今天总结topsort模板,学习了书上的那种方法另外也做了一题。。http://poj.org/problem?id=2585貌似网上也都是这种做法 ?先贴第一个代码#include<cstdio>#include<cstring>const int maxn = 50000 + 10;struct edge{ int to, w; edge * next;}*list[maxn];void add_edge(int u, int v,int w){ edge *tmp = new edge; tmp->to = v; tmp->w = w; tmp-> 阅读全文

posted @ 2012-07-31 03:26 louzhang_swk 阅读(466) 评论(0) 推荐(0) 编辑

2012年7月30日

118 - ZOJ Monthly, July 2012

摘要: http://acm.zju.edu.cn/onlinejudge/showContestProblems.do?contestId=339都是赛后做的。。。弱爆了A题是找由2和5组成的数字的个数直接打个表就行了只是比赛的时候不知道怎么打表啊。。View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;int a[1000];#define ll long longconst int inf = ~0U>>1;int cnt = 0;bool 阅读全文

posted @ 2012-07-30 00:34 louzhang_swk 阅读(343) 评论(0) 推荐(0) 编辑

2012年7月29日

种类位置信息:geometry

摘要: 这个主要讲的是各类位置相关函数的区别的main.cpp#include "geometry.h"int main(int argc, char *argv[]){ QFont font("ZYSong18030",12); QApplication::setFont(font); QApplication app(argc,argv); QTranslator translator(0); translator.load("geometry_zh","."); app.installTranslator(& 阅读全文

posted @ 2012-07-29 02:00 louzhang_swk 阅读(579) 评论(0) 推荐(0) 编辑

2012年7月28日

CUG2012年暑期ACM训练赛(单人赛)

摘要: A题是一个模拟或者说是搜索吧就跟倒可乐的问题差不多原题是ZOJ1005题View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std; char ans[101000][10];int main(){ int tcase; scanf("%d", &tcase); //int flag = 0; while(tcase --){ int count = 0; int x, y, z; scanf("%d%d%d" 阅读全文

posted @ 2012-07-28 23:26 louzhang_swk 阅读(388) 评论(0) 推荐(0) 编辑

标准对话框:StandardDialogs

摘要: QT对话框有很多种,有QDialog, QErrorMessage, QInputDialog, QMessageBox, QPrintDialog, QProgressDialog等。。这个标准对话框的例子要介绍了文件,字体,颜色对话框的使用main.cpp#include "standarddialogs.h"int main(int argc, char *argv[]){ QFont font("ZYSong18030",12); QApplication::setFont(font); QApplication a( argc, argv ); 阅读全文

posted @ 2012-07-28 10:11 louzhang_swk 阅读(365) 评论(0) 推荐(0) 编辑

第一个QT, "hello linux"

摘要: 本来是要这个月底做一个人人对战的五子棋的结果因为信安大赛一直拖直到前天才完成第一个输出昨天好好学了这两个感觉这个实例分析学不到什么东西= =、讲的都是实际,如果碰到另一种可能就不懂了有时间把CWM那本书借来看看下面是我的代码#include <QApplication>#include <QPushButton>int main(int argc, char *argv[]){ QApplication app(argc, argv); QPushButton b("hello linux!"); b.show(); QObject::connect 阅读全文

posted @ 2012-07-28 09:53 louzhang_swk 阅读(156) 评论(0) 推荐(0) 编辑