- 博客(25)
- 资源 (8)
- 收藏
- 关注
原创 UVA 10817 Headmaster's Headache 状压DP
记录两个状态S1,S2分别记录哪些课程被1个人教过或2个人教过,然后记忆化搜索UVA - 10817Headmaster's HeadacheTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit Status
2015-02-23 21:39:44 891
原创 UVA 1252 Twenty Questions 状压DP
简单状压DP: 当前状态s如果这个物品有状态a个属性,枚举下一个要猜测的特征k dp[s][a]=min(dp[s][a],max(dp[s+k][a],dp[s+k][a+k])+1);dp[s][a]=min(dp[s][a],max(dp[s+k][a],dp[s+k][a+k])+1);4643 - Twenty QuestionsAsia - Tokyo - 2009/201
2015-02-22 16:52:38 1136
原创 POJ 3398 / UVA 1218 Perfect Service 树形DP
树形DPPerfect ServiceTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 1378 Accepted: 668DescriptionA network is composed of N computers
2015-02-22 12:57:54 1269
原创 HDOJ 5155 Harry And Magic Box DP
dp[i][j] 表示 长宽为i,j的矩形的可能的总数dp[i][j+1] 可由 dp[i][j] 推过来,枚举dp[i][j]所保留的行数(1...i)即可Harry And Magic BoxTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S
2015-02-16 14:25:35 1191 2
原创 HDOJ 5154 Harry and Magical Computer floyd判环
floyd判环Harry and Magical ComputerTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1005 Accepted Submission(s): 404Problem
2015-02-15 22:35:34 888
原创 UVA 1220 / HDOJ 2412 Party at Hali-Bula 树形DP
树的最大独立集+判断唯一性Party at Hali-BulaTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionDear Contestant,
2015-02-15 19:55:13 923
原创 UVA 12186 Another Crisis 树形DP
树形DPAnother CrisisTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionA couple of years ago, a new worl
2015-02-15 15:44:09 956
原创 UVA 1331 Minimax Triangulation 区间DP
区间DP: 将一个多边形三角剖分,让可以得到的最大三角形的面积最小dp[i][j]表示从i点到j点的最优值,枚举中间点kdp[i][j]=min(dp[i][j],max(area(i,j,k),max(dp[i][k],dp[k][j])));注意如果中间三角形i-j-k中有其他的点,这样的三角形是不可以剖分的Minimax Triangu
2015-02-12 18:05:34 1403
原创 UVA1626 / ZOJ1463 Brackets sequence 区间DP
简单区间DP (有空串... ...)Brackets sequenceTime Limit: 4500MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionLet us define a
2015-02-11 23:27:45 912
原创 UVA1625 / UVALive 5841 Color Length DP
简单DP,dp[i][j]表示从第一个序列里取出i个和从第j个序列里取出j个的组合的最小值,可以从两个方向转移过来,每次转移加上已经出现过的且还没有出现完的字母的个数. O(n∗m)O(n*m)的复杂度.1625 Color LengthCars painted in different colors are moving in a row on the road as shown in Figu
2015-02-11 15:45:24 1105
原创 UVA 11584 Partitioning by Palindromes DP
题目链接n2n^2 的预处理i~j是不是回文串然后 n2n^2 的DP11584 Partitioning by PalindromesCan you read upside-down? We say a sequence of characters is a palindrome if it is the same written forwards and backwards. For e
2015-02-09 14:45:08 880
原创 UVA 11400 Lighting System Design DP
Lighting System DesignTime Limit: 8000MSMemory Limit: Unknown64bit IO Format: %lld & %lluSubmit StatusDescriptionProblem FLighting System DesignInput: Standard
2015-02-09 12:27:52 973
原创 UVA 12563 Jin Ge Jin Qu hao 01背包变形
基本的01背包,更新的时候保持背包里每一个元素的num最大然后time尽量长 CSDN也支持makedown了试一下 12563 Jin Ge Jin Qu hao (If you smiled when you see the title, this problem is for you ^_^) For those who don’t know KTV, see:
2015-02-08 22:24:46 1183
原创 UVA 1347 Tour DP
DPdp[i][j] 前i个点已经全部走过,落后的那个人在j号点往i+1号点转移 既 dp[i+1][i] or dp[i+1][j]TourTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit S
2015-02-07 23:48:43 1101
原创 UVA 437 The Tower of Babylon DP
有向图DAGThe Tower of BabylonTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionPerhaps you have heard of the
2015-02-07 22:08:03 871
原创 Codeforces 509E. Pretty Song
枚举子串的长度E. Pretty Songtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhen Sasha was studyin
2015-02-06 21:09:40 971
原创 Codeforces 509C. Sums of Digits 贪心枚举
贪心枚举,代码里的注释很详细C. Sums of Digitstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya had
2015-02-06 20:50:45 1639
原创 UVA 1642 Magical GCD 暴力+簡單數論
枚舉右端點,往前查找左端點....右端點一定的話,最多只有log個不同的gcd值,用一個數組記錄不同的GCD的值,對每個相同的GCD值記錄一下最靠左的位置...因爲GCD值不是很多所以 移動右端點時暴力統計即可..對與樣例:30 60 20 20 20從第1個數座右端點開始枚舉 // (gcd,位置)(30,1)枚舉以第2個數做爲右端點(30,1) (
2015-02-04 14:47:18 1749 1
原创 UVA10214 Trees in a Wood. 欧拉phi函数
只看某一个象限 能看到的数 == 一个 象限*4+4能看到的树既距离原点的距离 gcd(x,y)==1a 和 b 一大一小 预处理2000以内的phi函数,枚举小的一条边从1...a 与 a gcd 为 1 的数的个数就是 phi(a)从 1+a ... 2*a 与 a gcd 为 1 的数的个数 因为 GCD(i,a) = GCD(i+a,a) 所以还是 phi(a)...
2015-02-03 23:46:21 1191
原创 UVALive 3720 Highways 组合数学
根据对称性只考虑 \ 的斜线枚举 \ 所在的边框的大小 a,b 只有在 gcd(a,b) 不为1的情况下才是不重复的直线有(n-a)*(m-b)个, 如果边框的左上点接着一个边框的右下点则是重复的直线 需要减去 max(n-2*a,0)*max(m-2*b,0)个重复的边框所以对于一个边长为a,b的边框来说 有 (n-a)*(m-b) - max(n-2*a,0)*max(m-2*b,
2015-02-03 16:18:37 1165
原创 UVA 11440 Help Mr. Tomisu 欧拉phi函数
欧拉phi函数的改进版.....Help TomisuTime Limit: 7000MSMemory Limit: Unknown64bit IO Format: %lld & %lluSubmit StatusDescriptionProblem DHelp Mr. TomisuInpu
2015-02-03 14:18:14 1042
原创 POJ 2800 Joseph's Problem
给n 和 k 求: ∑1(k mod i). p = k/ik mod i = k - p * ik mod ( i + 1 ) = k - p * ( i + 1 ) = k mod i - pk mod ( i + 2 ) = k - p * ( i + 2 ) = k mod i - 2 * p对于连续的 i ,很多p都是一样的 . 相差的部分是一个等差数列 ,
2015-02-02 15:57:20 1154
原创 UVA 1641 POJ 4022 ASCII Area
统计斜杠出现了奇数次还是偶数次点击打开链接Long time ago, most of PCs were equipped with video cards that worked only in text mode. If theprogrammer wanted to show a picture on a screen, he had to use pseudograph
2015-02-02 10:48:31 1453
原创 UVA 10213 How Many Pieces of Land? 欧拉定理
欧拉定理 V-E+F=C+1Problem GHow Many Pieces of Land?Input: Standard InputOutput: Standard OutputTime Limit: 3 seconds You are given an elliptical shaped land and you are asked to ch
2015-02-02 00:34:54 1985
原创 HDOJ 1663 The Counting Problem 打表
先打出0~8位数,分别可以被整十/百/千/万...整除时 , 各个数字出现了几次的表先把每要查询的数字的每一位在表里查询得到一个结果但是这样是不全面的,考虑这样的情况: 例如2345这样的数 234* 这种情况下 4出现了5次 23**这种情况下3出现了45次 2***中2出现了345次等.....从后往前扫一遍即可其中0的情况比较特殊,简单的扫一遍会漏掉很多可能 比如 505
2015-02-01 18:05:41 1101
ManicTime Professional v2.5.2.1 简体中文破解版
2014-05-01
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人