- 博客(21)
- 收藏
- 关注
原创 Codeforces Round #305 (Div. 1) B. Mike and Feet(单调栈)
B. Mike and Feettime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMike is the president of country What-The-F
2015-05-31 01:40:25 1531
原创 hdu 5249区间第k大(学习了下树状数组的搞法)
KPITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 205 Accepted Submission(s): 70Problem Description你工作以后, KPI 就是你的全部了. 我开发了一
2015-05-30 23:48:04 1295
原创 矩阵小结
1.矩阵快速幂,用倍增来加速(O(n^3*logk))2.矩阵求解递推关系第n项(n很大)可以构造矩阵,用矩阵快速幂迅速求出。3.给定起点和终点求从起点到终点恰好进过k步的方案数可以直接对可达矩阵相乘k次得到结果4.矩阵乘法的顺序对时间影响比较大(提高Cache命中率),kij最快而且还可以进行稀疏矩阵加速(当a[i][k]为0时没必要进行运算)。因为最近在搞矩阵,所以准备写一个矩
2015-05-28 01:45:03 1273 6
原创 紫书第10章存题
UVA 580 枚举出现连续3个U第一次出现的位置。同时需要记录前i位不出现连续3个u的方案。#include #include #include #include using namespace std;typedef long long ll;const int maxn = 20 + 10;ll f[maxn],g[maxn];ll quick(ll a,int n)
2015-05-08 21:49:25 1387
原创 UVA 1638(动态规划)
有高为1到n的杆子各一根排成一行,从左往右能看见l根,从右往左能看见r根,问可能的方案数。dp[i][j][k]表示i根高度不同的杆子从左往右能看见j根,从右往左能看见k根,根据高度最低的那根杆子分类。#include #include #include #include using namespace std;typedef long long ll;const in
2015-05-08 21:32:23 1007
原创 UVA 11181(数学概率)
有n个人去超市,第i个人买东西的概率为p[i],逛完之后又r个人买了东西,求每个人实际买东西的概率。条件概率公式的应用,具体分析见算法竞赛入门经典第二版p327#include #include #include #include using namespace std;const int maxn = 100 + 10;double p[maxn],a[maxn];
2015-05-08 20:58:46 898
原创 Codeforces Round #302 (Div. 2) E. Remembering Strings(状压dp)
E. Remembering Stringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have multiset of n strings of th
2015-05-08 20:20:50 1342
原创 Codeforces Round #302 (Div. 2) D. Destroying Roads(最短路)
D. Destroying Roadstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn some country there are exactly n cit
2015-05-08 19:34:44 895
原创 Codeforces Round #302 (Div. 2)C (完全背包)
C. Writing Codetime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputProgrammers working on a large project have
2015-05-08 03:15:44 1036
原创 小Z的袜子(莫队算法)
A - 小Z的袜子(hose)Time Limit:20000MS Memory Limit:265216KB 64bit IO Format:%lld & %lluSubmit Status Practice HYSBZ 2038Description作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。
2015-05-07 21:36:55 3368
原创 UVA 1645(dp)
输入n,统计有多少个n节点的有根树。使得每个深度中所有节点的子节点数相同。可以根据节点的孩子个数dp。开始写了个记忆化,dp[n][p]表示n个节点,第一个节点有p个孩子的方案数#includeusing namespace std;typedef long long ll;const int maxn = 1000 + 5;const ll mod = 1e9 + 7;
2015-05-07 15:40:25 569
原创 UVA 10622 Perfect P-th Powers(数论)
UVA - 10622Perfect P-th PowersTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionProblem E: Perfect Pth Powers
2015-05-07 01:31:08 834
原创 UVA 1210 Sum of Consecutive Prime Numbers(数论)
UVA - 1210Sum of Consecutive Prime NumbersTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionSome positive integ
2015-05-07 01:26:05 1649
原创 UVA1213 Sum of Different Primes(素数打表+dp)
UVA - 1213Sum of Different PrimesTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionA positive integer may be ex
2015-05-07 01:18:55 1420
原创 UVA11005 Semi-prime H-numbers(筛法)
UVA - 11105Semi-prime H-numbersTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionProblem A: Semi-prime H-number
2015-05-07 01:12:31 1130
原创 UVA 12063(dp记忆化)
UVA - 12063Zeros and OnesTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionBinary numbers and their pattern o
2015-05-07 01:07:49 1762
原创 xdu 1022(数论筛法)
1022: A simple math problem 2时间限制: 1 Sec 内存限制: 128 MB提交: 73 解决: 13[提交][状态][讨论版]题目描述高斯函数: [x]表示,小于等于x的最大整数,即向下取整。 如 [2.5]=2,[1.2]=1等。 定义函数f(n)=[n/1]+[n/2]+[n/3]+...+[n/n] . sum(a,b)=f(a
2015-05-07 01:05:59 1020
原创 Codeforces Round #301 (Div. 2)D (概率dp)
D. Bad Luck Islandtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Bad Luck Island is inhabited by thre
2015-05-06 13:24:12 730
原创 Codeforces Round #301 (Div. 2)E(树状数组+离散化)
E. Infinite Inversionstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is an infinite sequence consis
2015-05-04 01:03:09 1254
原创 UVA 1640(数位统计)
The Counting ProblemTime Limit:3000MS Memory Limit:Unknown 64bit IO Format:%lld & %lluSubmitStatusDescriptionGiven two integers a and b, we write the numbers
2015-05-01 16:05:17 1052
转载 ACM组队经验
在天大,偶参加的比赛可以算是最多的了,说说比赛经验。 可能现在说早了点,需要大家在正式比赛之前再看一遍。 推荐此篇文章打印,与模板放在一起。 1. 比赛中评测会有些慢,偶尔还会碰到隔10分钟以上才返回结果的情况,这段时间不能等结果,必须开工其他题,如果WA,两道题同时做。交完每道题都要先打印。 2. 比赛时发的饭不是让你当时就吃的,那是给你赛后吃的。基本上比赛中前几
2015-05-01 15:41:23 1465
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人