自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(49)
  • 资源 (1)
  • 收藏
  • 关注

原创 ACM 程序设计竞赛 数学题目

1.burnside定理,polya计数法    这个大家可以看brudildi的《组合数学》,那本书的这一章写的很详细也很容易理解。最好能完全看懂了,理解了再去做题,不要只记个公式。    *简单题:(直接用套公式就可以了)    pku2409 Let it Bead      http://acm.pku.edu.cn/JudgeOnline/problem?id=2409

2017-06-29 14:02:08 2732

原创 POJ 2251 B - Dungeon Master——双广度优先搜索

题意:在一个三维空间中寻找起止点之间的最短路,每次可以朝着同一个平面的前后左右走,或者到上一个平面或下一个平面与当前平面相同的位置。思路:bfs暴一遍超时,考虑双向bfs#include #include #include #include #include using namespace std;const int dx[] = {0, 0, -1, 1};const

2017-06-29 13:57:21 346

原创 HDU 5542 The Battle of Chibi——树状数组 + dp

题目大意:给定一个长度为n的序列,问其共有多少个长度为m的子序列思路:用dp【i】【j】表示包含i个元素、第j个元素结尾的上升子序列的数量刚开始三重循环会超时:#include #include #include #include using namespace std;const int mod = 1000000007;int a[1010], dp[1010]

2017-06-29 10:42:54 321

原创 Qt图形视图框架(六) 为Item应用属性动画

Item之间的关系

2017-06-29 08:49:57 905

原创 Qt图形视图框架(五) 变换

拖放

2017-06-29 07:37:23 431

原创 Qt图形视图框架(三) 自定义QGraphicsItem

自定义QGraphicsItem

2017-06-28 17:18:58 2697

原创 Qt图形视图框架(二) 常见的QtGraphicsItem

常见的QtGraphicsItem1 创建一个以widget作为基类的项目,为了方便删除widget头文件以及其源文件,当然可以不删除2 因为要用到c++11特性,所以在pro文件中添加语句:[cpp] view plain copyCONFIG += c++11   3 修改main, 观察效果:#include

2017-06-28 10:33:26 561

原创 Qt图形视图框架(四) Item之间的关系

常见的QGraphicsItem的使用

2017-06-28 08:39:57 1096

原创 用ps实现图片背景透明

使用ps的快速选择选出要抠出来的区域点选择里的反向双击右下角图层,然后确定步骤阅读按delete,然后另存为png格式就完成了

2017-06-28 08:31:50 409

原创 Qt make: *** No rule to make target 问题

一般是对文件进行修改导致路径不对应造成的,比如在直接修改Qt资源文件等,解决方法是删除目录下的build ***Disktop****文件,然后重新编译

2017-06-28 08:23:00 2516

原创 Qt图形视图框架(一) Graphics View Framework介绍

Graphics View Framework介绍当你有大量2D图元需要展现时,可以使用图形视图框架。图形视图框架中的图元,能够处理用户交互事件(鼠标、键盘事件等),支持平移,缩放,旋转等变换。你可以为图元应用图形效果及动画。当你需要时,可以定义自己的图元。 图形视图框架有三类基本元素:QGraphicsScene,QGraphicsItem,QGraphicsView,三者关系: 假

2017-06-27 12:04:45 1105

原创 QT——程序启动画面

使用QSplashScreen类可实现启动画面的添加#include "widget.h"#include #include #include int main(int argc, char *argv[]){ QApplication a(argc, argv); QSplashScreen *splash = new QSplashScreen; sp

2017-06-26 19:47:38 561

原创 UML详解

在UML 2.0的13种图形中,类图是使用频率最高的UML图之一。Martin Fowler在其著作《UML Distilled: A Brief Guide to the Standard Object Modeling Language, Third Edition》(《UML精粹:标准对象建模语言简明指南(第3版)》)中有这么一段:“If someone were to come up to

2017-06-26 15:42:16 624

原创 POJ 3254 Corn Fields——状态压缩dp

Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squares. Regrettably,

2017-06-25 21:49:26 352

原创 HDU 1754 I Hate It——单点更新的线段树

很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0学生ID编号分别从1编到N。 第二

2017-06-21 21:43:00 264

原创 HDU 1166 敌兵布阵——单节点更新的线段树

C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术

2017-06-21 15:44:14 317

转载 线段树详解

线段树详解By 岩之痕目录:一:综述二:原理三:递归实现四:非递归原理五:非递归实现六:线段树解题模型七:扫描线八:可持久化 (主席树)九:练习题一:综述假设有编号从1到n的n个点,每个点都存了一些信息,用[L,R]表示下标从L到R的这些点。线段树的用处就是,对编号连续的一些点进行修改或者统计操作,修改

2017-06-20 22:12:05 386

转载 Qt Creator 快捷键

出处:blog.csdn.net/liang19890820/article/details/49928493#一般快捷键简介Qt Creator中提供了各种快捷键来加快开发进程。如果需要查看或自定义快捷键,选择工具->选项->环境->键盘。快捷键按类别列出,可以在过滤器(Filter)处输入命令名称、标签名称或快捷键名称,来快速定位想要查找的快捷键。以红颜色显示的

2017-06-20 10:23:47 530

原创 QT使用QPainter绘图

环境:UBUNTU14.04/QT4简介:    QT的二维图形引擎是基于QPainter类的,QPainter既可以绘制几何图形,又可以绘制像素映射,图像和文字,除此之外还有一些高级功能。    QPainter可以画在“绘图设备上”,如QWidget,QPixmap,QImage或者QSvgGenerator,也可以与QPrinter一起使用来打印文件和创建PDF文档,这意

2017-06-15 00:07:47 26547 2

原创 HDU 4968 Improving the GPA——暴力

五层循环,暴力求解#include #include using namespace std;const int INF = 0x3f3f3f3f;int main(){ int T; scanf("%d", &T); while (T--) { double average, n; scanf("%lf %lf", &avera

2017-06-13 22:27:06 358

原创 UVa 12166 Equilibrium Mobile——思路题

由平衡可知父节点的质量等于子节的两倍,某层的质量等于他下面一层质量的两倍,最终第0层的质量就是整棵树的质量(这里的质量其实类似于一种权值的累加,不是实际质量,不要误以为是所有叶子质量之和。。。。。。)以1片叶子为基点,则1片叶子就可以决定1棵树的质量;以n片叶子为基点,则n片叶子就可以决定n棵树的质量;如果n棵树中有两棵树的质量相同,则作为他们基点的两片叶子是不用修改的;

2017-06-11 15:11:08 494

原创 UVa 1600 Patrol Robot——bfs

三维数组判重#include #include #include #include #include using namespace std;const int dx[] = {-1, 1, 0, 0};const int dy[] = {0, 0, -1, 1};int G[50][50], m, n, k, vis[50][50][20];struct Node

2017-06-10 22:28:11 261

原创 UVa 439 Knight Moves——bfs

#include #include #include #include #include using namespace std;int G[10][10], sx, sy, ex, ey;struct Node { int x, y, step;}node;bool edge(int x, int y) { if (0 <= x && x < 8 && 0

2017-06-10 21:30:56 262

原创 UVa 536 Tree Recovery——树的遍历

#include #include #include #include #include using namespace std;string a, b;void dfs(int p1, int p2, int q1, int q2, int root) { if (p1 > p2) return; for (root = q1; a[p1] != b[root

2017-06-10 15:41:04 225

原创 UVa 712 S-Trees——进制转化

直接将二进制转化成十进制,注意顺序#include #include #include #include using namespace std;int n, m, a[1000], b[10], pos[10], flag = 0;char str[1000];int change() { int sum = 0; for (int i = 0; i <

2017-06-10 14:45:25 205

原创 POJ 1321 棋盘问题——dfs

#include #include #include #include using namespace std;char G[10][10];int n, k, ans, vis[10];void dfs(int i, int num) { if (num == 0) { ans++; return; } if (i == n) return; for

2017-06-09 22:16:05 261

原创 HDU 1532 Drainage Ditches——最大流EK算法

模板题#include #include #include #include #include using namespace std;const int INF = 0x3f3f3f3f;const int maxn = 1000 + 10;struct Node { int to; int cap; int rev;};vector v[

2017-06-09 15:53:31 256

原创 UVa 12545 Bits Equalizer——贪心

先把能交换的交换了,尽量交换,然后进行数字的变换,变换过程中遇到1 到 0直接输出-1;变换过程好说,交换过程要考虑的情况比较多首先把具体的数字进行交换,二层循环然后把带问号的数字进行交换,具体怎么交换看代码,又是二层循环最后一层循环解决变换问题最终复杂度为O(n^2)#include #include #include #include using namesp

2017-06-08 16:26:32 328

原创 Uva 11093 Just Finish it up——思路题

#include #include using namespace std;const int maxn = 100000 + 10;int n, a[maxn], b[maxn];int main(){ int T, flag = 0, i, j, sum; scanf("%d", &T); while (T--) { scanf("%d", &

2017-06-07 17:37:29 314

原创 Uva 12627 Erratic Expansion——递推

注意用long long#include using namespace std;long long c[50];long long dfs(int k, int i) { if (i == 0) return 0; if (k == 0) return 1; int kk = 1 << (k - 1); if (kk > i) return dfs

2017-06-07 11:49:19 311

原创 HDU 2089 不要62——数位dp

#include #include #include #include using namespace std;typedef long long ll;int a[20];int dp[20][2];int dfs (int pos, int pre, int sta, int limit) { if (pos == -1) return 1; if (!

2017-06-06 00:16:39 295

原创 UVa 714 Copying Books——二分最大值最小化

注意上界在累加时可能超过int范围#include #include #include #include using namespace std;int m, k;long long a[1000];bool judge(long long x) { long long sum = 0, cnt = 1; for (int i = m; i >= 1; i-

2017-06-05 20:52:27 323

原创 UVa 1451 Average——斜率优化

思路紫书上写的就很好,这里只强调一点:注意要求的斜率是(Sj - Si-1)/(j - i + 1),一定要注意这个i-1,假如想得到前三个数的平均值,在图上就要从0开始,求0到3的平均值,而不是1到三的平均值。说的有点抽象,还请读者琢磨一下代码里的+1-1的问题#include #include #include #include using namespace std;

2017-06-05 18:42:00 497

原创 UVa 1606 Amphiphilic Carbon Molecules——极角扫描

#include #include #include #include #include using namespace std;const int maxn = 1010;struct Node { int x, y, col; double rad; bool operator < (const Node &node) { retur

2017-06-03 10:51:32 284

原创 UVa 1471 Defense Lines——LIS nlogn 算法变形

建议做这个题之前先学习一下LIS 的 nlogn 算法注意二分查找时我们需要的是小于a【i】的数而不是等于甚至大于a【i】的数,当更新ans时发现貌似缺了1而无法理解代码时仔细考虑一下这一点#include #include #include #include using namespace std;const int INF = 0x3f3f3f3f;const int

2017-06-02 21:23:58 318

原创 UVa 10954 Add All ——优先队列

用优先队列实现Huffman算法#include #include #include #include #include using namespace std;int main(){ int n, x; while (scanf("%d", &n) == 1 && n) { priority_queue, greater > q;

2017-06-01 21:20:34 275

原创 UVa 11572 Unique Snowflakes——思路题

这个题划分一下子问题就很好理解了设ans【i】是以第i个元素为首的最长集合的长度,那么求解过程便是对于每一个i,尽量将其无限延长,直到出现重复元素为止,那么结果便是所有ans【i】的最大值实际操起来时,我们可以用【L, R)表示一个序列的区间,开始L = R = 0,然后将R无限延长直到出现重复元素,这时直接将L + 1,然后继续无限延长R,出现重复元素后再把L + 1....

2017-06-01 20:48:27 242

原创 Problem D: STL——括号匹配

Problem D: STL——括号匹配Description给出一堆括号,看其是否匹配,例如 ()、()()、(()) 这样的括号就匹配,      )(、)()) 而这样的括号就不匹配Input每一行代表一组测试样例,每组测试样例只包含'('和')',样例长度不超过100个字符Output如果所有的括号都匹配,那么输出YES,否则

2017-06-01 19:41:00 514

原创 Problem C: STL——Jerry的问题

Problem C: STL——Jerry的问题Description最近Jerry正在刻苦的学习STL中的set的功能函数,他发现set可以用现有的函数实现并、交、差、对称差等功能,但是他没有找到怎么来比较两个集合是否相等的功能函数,所以他想自己用其他的功能函数来实现能判断两个集合是否相等的功能函数。聪明的Jerry不一会就想到了解决办法,现在他想拿这道题来考考你,看你有没有他聪

2017-06-01 19:33:38 755

原创 Problem B: STL——集合运算

Problem B: STL——集合运算Description集合的运算就是用给定的集合去指定新的集合。设A和B是集合,则它们的并差交补集分别定义如下:A∪B={x|x∈A∨x∈B}A∩B={x|x∈A∧x∈B}A-B={x|x∈A∧x不属于 B}SA ={x|x∈(A∪B)∧x 不属于A}SB ={x|x∈(A∪B)∧x 不属于B}Input第

2017-06-01 19:31:39 1113

Qt游戏编程——飞机大战

游戏模板,大家可以随意添加自己的元素

2017-07-06

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除