- 博客(27)
- 问答 (1)
- 收藏
- 关注
原创 python3中的一些数据结构和高阶函数(python3.5)
python中的list:list用[]表示,中文名为列表list下标为正数时从0开始计数(从左往右)(0到正无穷),下标为为负数时从-1开始(从右往左)(-1到负无穷)。list的几个方法: x.append(xxx) 给x这个list末尾增加新元素xxx x.insert(i, xxx) 给x这个list的第i个位置改成xxx,其余元素后移
2016-08-31 20:33:31 3181 1
原创 hdu1698 Just a Hook(线段树,区间更新)
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1698题意:某个钩子由n个小钩子组成,有q个操作,将某个区间内的小钩子的材料改变,有金银铜三中材料,每种材料价钱不同。问最后这个钩子的价值思路:线段树,区间更新(不是相加更新),最后输出根节点的值即可。关键在于,如何理出用线段树来解决这一题,重点是理解更新。
2016-08-19 20:55:26 295
原创 poj3468 A Simple Problem with Integers(线段树,区间更新,区间和查询)
题目链接:http://poj.org/problem?id=3468题意:给出n个数,有q个操作,其中一种操作是将某个区间都加上某一个整数,另一个操作是询问某个区间的和。思路:线段树,区间更新,区间和查询。区间更新自然用到lazy-tag。模板题,关键还是理解模板。注意数据范围代码:#include #include #includ
2016-08-19 20:46:05 349
原创 poj3264 Balanced Lineup(ST表)
链接:http://poj.org/problem?id=3264题意:n头牛排成一行,问a到b这个区间内最高的牛和最矮的牛的身高差。思路:这题用的是ST表,初学ST。这题算模板题了,关键还是要理解。。另外,某位巨巨说用代码中的方法求k值可能会被卡。代码:#include #include #include #include #i
2016-08-19 20:34:49 290
原创 hdu2795 Billboard (线段树,单点更新)
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2795题意:有一个高为h,宽为w的billboard,有n个广告,每个广告高1,宽为wi,将n个广告从上往下放,并且尽可能放满一行,问n个广告分别放在哪一行。思路:线段树,这里可以一边查询一边更新,每个树节点存对应区间中所能放的广告长度的最值,初始化为w,那么
2016-08-19 20:12:34 277
原创 hdu1754 I Hate It(线段树,单点更新,区间最值)
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1754思路:线段树,实现单点更新,区间最值查询注意:注意字符的处理,要么用getchar()来处理,要么用字符数组来处理。代码:#include #include #include #include using namespace s
2016-08-19 19:58:21 268
原创 poj2352 && hdu1541 Stars(树状数组)
Stars Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
2016-08-16 18:09:42 361
原创 CodeForces 25C(Floyd)
Roads in BerlandTime Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit Practice CodeForces 25CDescriptionThere are n cities numbered from 1 to n i
2016-08-13 23:47:26 359
原创 CodeForces 505B(并查集)
Mr. Kitayuta's Colorful GraphTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit Status Practice CodeForces 505BDescriptionMr. Kitayuta has just b
2016-08-13 23:30:24 462
转载 用数组实现邻接表
#include #include using namespace std;int main(){ int n, m; int u[10], v[10], w[10]; int first[10], next[10]; cin>>n>>m; for(int i=1; i<=n; i++) first[i] = -1; for(int i=1; i<=m; i++)
2016-08-10 10:57:13 692
原创 poj2395 Out of Hay(最小生成树)
Out of HayTime Limit: 1000MS Memory Limit: 65536KT DescriptionThe cows have run out of hay, a horrible event that must be remedied immediately. Bessie intends
2016-08-10 00:18:41 312
原创 poj1861 Network(kruskal求最小生成树)
NetworkTime Limit: 1000MS Memory Limit: 30000K DescriptionAndrew is working as system administrator and is planning to establish a new network in his
2016-08-10 00:05:29 372
原创 hdu2544 最短路(dijkstra求单源最短路)
最短路 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem Description在每年的校
2016-08-09 23:44:41 278
原创 hdu2112 HDU Today(dijkstra求单源最短路)
HDU Today Time Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem Description经过锦囊相助,海东集团
2016-08-09 23:33:21 276
原创 hdu1233 还是畅通工程(MST最小生成树)
还是畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem Description某省调查乡村
2016-08-09 23:08:31 247
原创 hdu1232 畅通工程(并查集)
畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem Description某省调查
2016-08-09 22:49:11 201
原创 hdu1596 find the safest road(dijkstra求最短路)
find the safest road Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem
2016-08-08 08:56:39 347 4
转载 关于扩展欧几里得算法的一些资料
https://zh.wikipedia.org/wiki/%E6%89%A9%E5%B1%95%E6%AC%A7%E5%87%A0%E9%87%8C%E5%BE%97%E7%AE%97%E6%B3%95(维基百科)http://m.blog.csdn.net/article/details?id=50695810
2016-08-07 10:46:27 231
原创 codeforces 185A Plant(矩阵快速幂)
A. Planttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDwarfs have planted a very interesting plant, which is a triangle directed "upwards". This...
2016-08-07 00:50:59 420
原创 poj1064 Cable master(二分)
Cable masterTime Limit: 1000MS Memory Limit: 10000K DescriptionInhabitants of the Wonderland have decided to hold a regional programming contest. The Judging
2016-08-06 23:55:56 371
原创 poj3737 UmBasketella(三分)
UmBasketellaTime Limit: 1000MS Memory Limit: 65536K DescriptionIn recent days, people always design new things with multifunction. For instance, you can not
2016-08-04 20:04:21 236
原创 poj 3320 Jessica's Reading Problem(尺取法)
Jessica's Reading ProblemTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10535 Accepted: 3515DescriptionJessica's a very lovely girl wooed by lots of
2016-08-04 19:53:14 323
原创 hdu 2289 Cup (二分)
CupTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionThe WHU ACM Team has a big cup, with which every member drinks water. Now, we know
2016-08-04 19:38:41 238
原创 hdu 2141 Can you find it?(二分)
Can you find it?Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/10000 K (Java/Others)Total Submission(s): 24218 Accepted Submission(s): 6127Problem DescriptionGive you th
2016-08-04 19:27:13 207
原创 poj 3122 Pie(二分法)
PieTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uDescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number
2016-08-04 19:10:34 344
原创 关于数据类型是浮点数的二分法
以前写二分变量都是整型类型的二分,最近写了两题浮点数的二分,发现了自己在处理精度时有很多问题。所以在这小小的总结一下个人目前使用的浮点数二分写法是这样的:/* l为左端点,r为右端点,mid为二分中点, ans为最终答案,cmp为对比值 check()函数计算当前mid所产生的值*/const double eps = 1e-9; double l, r, mid,
2016-08-04 19:00:31 1167
原创 一维费用的背包问题模板
int v; //v为背包容量int T, N, V;int val[1010], vol[1010];int dp[1010];int v; //v为背包容量void ZeroOnePack(int cost, int val){ //cost为花费, val为价值 for(int i=v; i>=cost; i--) dp[i] = max(dp[i], dp[i-cost
2016-08-02 10:09:07 370
空空如也
数据表记录删除问题(假删除?)
2021-06-29
TA创建的收藏夹 TA关注的收藏夹
TA关注的人