自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(60)
  • 收藏
  • 关注

原创 cuda学习

链接1链接2cudaSetDevice(ID): 主机线程调用此方法设置所要运行的设备,即激活编号为ID的设备使用。设备内存分配和内核启动是在当前设置的设备上进行的;流和事件是与当前设置的设备关联创建的。 如果没有调用cudaSetDevice(),则当前设备是设备0。cudaGetDevice(): 获取当前的设备IDcudaError_t CUDARTAPI...

2020-04-28 23:05:34 1338

原创 蓝桥杯 连号区间数

思维题:一个区间是否连续,就看这个区间中(最大值 - 最小值 + 1)是否等于区间长度......#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>using namespace std;const int maxn = 5050;int...

2019-05-25 11:13:47 261

原创 树上最远两点 双向dfs

例题1:蓝桥杯 大臣的旅费一开始正确75%,是因为数组开小了......复杂度为o(n),尽可能开大些。vis版本:#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#include<vector>using namesp...

2019-05-21 13:55:24 333

原创 cf982C(dfs)

题目链接题意:给你一棵树,即n个节点n-1条边,问最多能删除多少边,使得各个子树的节点数为偶数。一开始想当然的以为,奇数个节点直接输出-1,偶数个节点答案即为节点数/2 - 1,多画了几个图才发现不对。dfs遍历,如果当前节点的子树个数(包括该节点自身)为偶数,则答案ans++。因为偶数+偶数 = 偶数,巧妙#include<cstdio>#include&lt...

2019-05-20 18:09:38 662

原创 hdu3427(记忆化搜索)

题目链接题意:字符串消消看,当两个或以上挨着的字符相同时才可以消去(一个单独字符无法消去),最后可以消去至空的字符串solvable,反之unsolvable。题解一题解二记忆化搜索。题解一有一处仍未理解,题解二按照题目暗示的思路进行dfs,注意理解为什么是先判断xy型,然后AxA,AxAyA。#include<cstdio>#include<iost...

2019-05-20 12:41:27 248

原创 hdu6287(思维)

#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#include<vector>#include<cmath>using namespace std;const int maxn = 1e5 + 10;i...

2019-05-20 10:49:59 189

原创 蓝桥杯 国王的烦恼

题目链接+题解并查集+思维。一开始想先按天数从小到大排序,然后遍历边,看是否在一个集合中,然后......就对题目要求卡住了,因为按从小到大加入集合,天数是不对的,拿题目例子可以看出,变为3天(而且这个思路也没道理)题解按天数从大到小,妙#include<cstdio>#include<iostream>#include<cstring&g...

2019-05-19 16:09:35 369

原创 蓝桥杯 最大子阵

将二维压缩为一维后,再利用动态规划中基础的最大子段和。最大连续子序列和:dp[i - 1] > 0, dp[i] = a[i - 1] + a[i]dp[i - 1] < 0, dp[i] = a[i]#include<cstdio>#include<algorithm>using namespace std;const int m...

2019-05-19 12:10:23 146

原创 蓝桥杯 蚂蚁感冒

类似挑战白皮的蚂蚁问题,转换思维即可。题目思路#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;const int maxn = 60;int a[maxn];int n;int main...

2019-05-19 12:10:13 191

原创 hdu6288(二分+高精度)

题目链接参考博客此题要用到__int128,不然会溢出。或者用除法的一种题解方式...博客代码while循环退出条件写错,应该是l <= r......WA了半天才发现注意:可以用循环乘代替pow,避免使用double。#include<iostream>#include<cmath>#include<algorithm>usi...

2019-05-18 22:31:46 141

原创 Servlet配置文件

web.xml详解一web.xml详解二context-param和init-param参数获取init-param参数获取web.xml配置路径时全部都正确,访问servlet就是404,后来发现是@WebServlet没匹配,也会影响。访问servlet路径:http://computer_name:portnumber/root/url-pattern(web....

2019-05-18 15:28:11 701

原创 杂记

普通除法与移位辨析using各种用法

2019-05-17 23:12:56 112

原创 poj2228(dp)

题目链接四行的dp WA了,两行的AC了。待解决......#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>#include<string>using namespace std;const int INF = 0x...

2019-05-17 23:06:18 216

原创 两种web service对比

特点比较及适用情况xml-based和restful web service对比

2019-05-15 10:13:30 170

原创 xml-based web service

wsdl和soap标签详解xml标签中命名空间相关了解soap理解soap消息的封装发送过程理解

2019-05-15 10:12:40 196

原创 hdu6282(思维)

#include<bits/stdc++.h>using namespace std;string a, b;const int maxn = 1e4 +10;int l[2][maxn];int transform_s(int x, string s){ int sum = 0, num = 0; for(int i = 0; i <...

2019-05-11 22:47:01 279

原创 hdu6281(思维)

题目链接在写cmp判断函数时,如果直接相乘比较会溢出,需要转化下比较的式子~#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>using namespace std;const int maxn = 1010;typedef long lo...

2019-05-11 22:00:38 232

原创 hdu6277(思维)

题目链接在一篇论文上多花时间和开新的论文, a * x求和完全等效,因为 = n,只是拆分方法不同,总合都是a * n。eg: n = 3, a = 2, 拆分为1 1 1, 则基础引用量为2 2 2, trick引用量2 1 0,总效果2+2 2+1 2;拆分为2 1,则基础引用量为4 2(基础部分综合相同),trick引用量1 0(比论文篇数多的情况少),总效果为4+1 2+0,减...

2019-05-11 12:18:13 428

原创 hdu6286

题目链接给定两个区间,这两个区间内分别取x,y,求x * y是2018倍数的方案数。2018的因数只有1、2、1009、、2018四个,所以想到左右区间找这几个因数的倍数,然后左右相乘再处理,组合的思想,分类讨论两个区间。需要求出某区间内某个数的倍数的个数,边界值的处理需要注意。。。#include<cstdio>#include<cstring>#inc...

2019-05-10 23:44:40 322

原创 cf999E(tarjan)

核心:因为入度不为0的联通块,总能通过它所连接的块连到s所在块上。vector版本:#include<cstdio>#include<iostream>#include<algorithm>#include<cstring>#include<vector>using namespace std;const...

2019-05-10 11:44:53 441

原创 cf 510C(字符串、拓扑)

题目链接简单的字符串拓扑应用。#include<cstdio>#include<iostream>#include<algorithm>#include<cstring>#include<vector>#include<queue>using namespace std;const int maxn ...

2019-05-09 21:21:59 205

原创 cf914F(字符串)

题目链接bitset用法搁置了好几天,终于想通......#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>#include<bitset>using namespace std;const int maxn = 1e5 +...

2019-05-09 19:47:41 335

原创 Uva1328(kmp)

题目链接讲解引用博客循环节部分有待继续理解#include<bits/stdc++.h>using namespace std;const int maxn = 1e6 + 10;char s[maxn];int f[maxn];void solve(){ int m = strlen(s); f[0] = f[1] = 0;...

2019-05-09 16:35:47 155

原创 区间dp入门

区间dp入门#include<bits/stdc++.h>using namespace std;const int maxn = 110;const int INF = 0x3f3f3f3f;int a[maxn];int dp[maxn][maxn];int sum[maxn][maxn];int n;int main(){ cin &gt...

2019-05-08 16:41:23 154

原创 洛谷奶酪塔(dp)

一开始想把每块奶酪高度压缩4/5后,价值不变,当作新的物品加入,但是忽略了前提:有大奶酪的时候下面的奶酪才会压缩,而在dp过程中无法加入判断。正解#include<bits/stdc++.h>using namespace std;const int maxn = 1010;int dp[1500]; //注意数据扩大5/4倍,数组需...

2019-05-03 13:52:38 426

原创 hdu1024(最大m子段和)

题目链接#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;typedef long long ll;const int maxn = 1e6 + 10;const ll INF = 35000;int...

2019-05-03 12:57:11 146

原创 Wishare H题

小A要发布一个视频展现他优秀的球技,视频有n帧,小A有m个粉丝,如果同时有两个以上的粉丝看到他秀球技的一帧,该视频就会被广为传播,导致所有的粉丝发疯。每个粉丝会在y = k * ai + ri 时刻看视频,k为整数,问在保证粉丝不发疯的情况下小A可以在多少帧里炫技?0 < a <= 100,0 <= r < a,1 <= n,m <=1e5仔细观察数据量...

2019-05-02 14:14:46 209

原创 Wishare A题

#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<vector>#include<stack>#include<queue>#include<cmath>#include<...

2019-05-01 19:26:38 159

原创 Wishare D题

题目:教练评估了每一个人的能力值,现在想要将队伍分成两组进行对抗。一个队的能力值为该队所有人能力值之和。教练希望两队的能力值尽可能接近,但是不知道如何分组。教练希望你能够帮助他解决这个问题。输入:一个整数n,表示有n个人。 2 <= n <= 32a1,a2...an表示每个人能力值。1 <= ai <= 10^12输出:当两队能力值最接近时,两队能力值...

2019-05-01 19:23:55 350

原创 洛谷垃圾陷阱(dp)

确定dp代表的含义如上图,代码采用一维dp#include<bits/stdc++.h>using namespace std;const int maxn = 110;int dp[maxn];int D, G;struct Trash{ int t, f, h;}tra[maxn];bool cmp(Tra...

2019-04-30 23:56:09 341 2

原创 cf Round552E(思维)

#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>#include<vector>#include<map>#include<queue>#include<set>using namespace ...

2019-04-29 22:12:06 102

原创 洛谷1757(分组背包)

#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#include<vector>using namespace std;const int maxn = 110;vector<int> w[maxn];vector...

2019-04-26 20:47:22 309

原创 2050编程 1003分宿舍(dp)

当时看题以为需要好多种分类讨论,看到题解的dp简单机智...(还是自己dp没学会)dp用的妙#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>using namespace std;typedef long long ll;const ...

2019-04-26 17:53:01 248

原创 南邮Wishare小Z吃自助餐(dp 最大m子段和)

有一篇讲解最大m子段和的博客,了解知识点再看题 。代码:#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>using namespace std;typedef long long ll;const int maxn = 1e5 + 1...

2019-04-26 17:39:45 344

原创 最大m子段和(dp知识点)

讲解的好博客例题:51nod1052#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>using namespace std;typedef long long ll;const int maxn = ...

2019-04-26 17:26:46 607

原创 hdu1251(Trie)

题目链接#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>using namespace std;const int maxn = 1e6 + 10;int trie[maxn][28], num[maxn];//bool tail[maxn...

2019-04-25 16:10:59 139

原创 hdu6495 冰水挑战(dp)

题目链接讲解的好博客本质是01背包问题。dp[i][j]表示前i个挑战中选择j个挑战剩余的体力最大值。不同的是,在装入背包时多了一个限制,选择当前挑战的状态的体力最小值必须>=当前挑战所需的体力值,否则不能转移;不选择当前挑战,则只要之前的体力值>0即可转移。#include<cstdio>#include<cstring>#inclu...

2019-04-25 15:59:27 140

原创 hdu1251(字符串Trie)

Trie基础题数组写法:#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>using namespace std;const int maxn = 1e6 + 10;int trie[maxn][28], num[maxn];/...

2019-04-24 16:51:33 176

原创 字符串之Trie

了解trie刘汝佳白皮也可以。链表写法:#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>using namespace std;const int maxn = 3e3 + 10;const int sz = 28;...

2019-04-24 16:44:54 127

原创 uva8183(字符串处理)

#include<cstdio>#include<cstring>#include<string>#include<algorithm>#include<iostream>#include<set>#include<vector>using namespace std;boo...

2019-04-23 21:37:07 143

空空如也

空空如也

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

TA关注的人

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