POJ 题目整理

合集下载

POJ 动态规划题目列表

POJ 动态规划题目列表

[1]POJ动态规划题目列表容易: 1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1208, 1276, 1322, 1414, 1456, 1458, 1609, 1644, 1664, 1690, 1699, 1740(博弈), 1742, 1887, 1926(马尔科夫矩阵,求平衡), 1936,1952, 1953, 1958, 1959, 1962, 1975, 1989, 2018, 2029,2039, 2063, 2081, 2082,2181, 2184, 2192, 2231, 2279, 2329, 2336, 2346, 2353,2355, 2356, 2385, 2392, 2424,不易: 1019,1037, 1080, 1112, 1141, 1170, 1192, 1239, 1655, 1695, 1707,1733(区间减法加并查集), 1737, 1837, 1850, 1920(加强版汉罗塔), 1934(全部最长公共子序列), 1937(计算几何), 1964(最大矩形面积,O(n)算法), 2138, 2151, 2161(烦,没写), 2178,推荐: 1015, 1635, 1636(挺好的), 1671, 1682, 1692(优化), 1704, 1717, 1722, 1726, 1732, 1770, 1821, 1853, 1949, 2019, 2127, 2176, 2228, 2287, 2342, 2374, 2378, 2384, 2411 状态 DP 树 DP 构造最优解四边形不等式单调队列1015 Jury Compromise1029 False coin1036 Gangsters1037 A decorative fence1038 Bugs Integrated, Inc.1042 Gone Fishing1050 To the Max1062 昂贵的聘礼1074 Parallel Expectations1080 Human Gene Functions1088 滑雪1093 Formatting Text1112 Team Them Up!1141 Brackets Sequence1143 Number Game1157 LITTLE SHOP OF FLOWERS 1159 Palindrome1160 Post Office1163 The Triangle1170 Shopping Offers1178 Camelot1179 Polygon1180 Batch Scheduling1185 炮兵阵地1187 陨石的秘密1189 钉子和小球1191 棋盘分割1192 最优连通子集1208 The Blocks Problem 1239 Increasing Sequences 1240 Pre-Post-erous!1276Cash Machine1293 Duty Free Shop1322 Chocolate1323Game Prediction1338 Ugly Numbers1390 Blocks1414 Life Line1432 Decoding Morse Sequences 1456 Supermarket1458 Common Subsequence1475 Pushing Boxes1485 Fast Food1505 Copying Books1513 Scheduling Lectures1579 Function Run Fun1609 Tiling Up Blocks1631 Bridging signals 2 分+DP NLOGN 1633 Gladiators 1635 Subway tree systems 1636 Prison rearrangement1644 To Bet or Not To Bet1649 Market Place1651 Multiplication Puzzle1655 Balancing Act1661 Help Jimmy1664 放苹果1671 Rhyme Schemes1682 Clans on the Three Gorges1690 (Your)((Term)((Project)))1691 Painting A Board1692 Crossed Matchings1695 Magazine Delivery1699 Best Sequence1704 Georgia and Bob1707 Sum of powers1712 Flying Stars1714 The Cave1717 Dominoes1718 River Crossing1722 SUBTRACT1726 Tango Tango Insurrection 1732 Phone numbers1733 Parity game1737 Connected Graph1740 A New Stone Game1742 Coins P1745 Divisibility1770 Special Experiment1771 Elevator Stopping Plan 1776 Task Sequences1821 Fence1837 Balance1848 Tree1850 Code1853 Cat1874 Trade on Verweggistan 1887 Testing the CATCHER 1889 Package Pricing1920 Towers of Hanoi1926 Pollution1934 Trip1936 All in All1937 Balanced Food1946 Cow Cycling1947 Rebuilding Roads1949 Chores1952 BUY LOW, BUY LOWER 1953 World Cup Noise1958 Strange Towers of Hanoi 1959 Darts1962 Corporative Network 1964 City Game1975 Median Weight Bead 1989 The Cow Lineup2018 Best Cow Fences2019 Cornfields2029 Get Many Persimmon Trees2033 Alphacode2039 To and Fro2047 Concert Hall Scheduling2063 Investment2081 Recaman's Sequence2082 Terrible Sets2084 Game of Connections2127 Greatest Common Increasing Subsequence 2138 Travel Games2151 Check the difficulty of problems2152 Fire2161 Chandelier2176 Folding2178 Heroes Of Might And Magic2181 Jumping Cows2184 Cow Exhibition2192 Zipper2193 Lenny's Lucky Lotto Lists2228 Naptime 2231 Moo Volume2279 Mr. Young's Picture Permutations2287 TianJi -- The Horse Racing 2288 Islands and Bridges2292 Optimal Keypad2329 Nearest number - 22336 Ferry Loading II2342 Anniversary party2346 Lucky tickets2353 Ministry2355 Railway tickets2356 Find a multiple2374 Fence Obstacle Course2378 Tree Cutting2384 Harder Sokoban Problem2385 Apple Catching2386 Lake Counting2392 Space Elevator2397 Spiderman2411 Mondriaan's Dream2414 Phylogenetic Trees Inherited 2424 Flo's Restaurant2430 Lazy Cows2915 Zuma3017 Cut the Sequence 3028 Shoot-out3124 The Bookcase3133 Manhattan Wiring 3345 Bribing FIPA3375 Network Connection 3420 Quad Tiling ?。

Spoj解题报告

Spoj解题报告
Spoj 解题报告
题号 428 PART PALI 题目名称 Particular Palindromes 题目大意 求长度为 S 的能被 M 整除 的回文数字(即没有前导 0 的回文串)的个数。 算法讨论 DP。 f(i,j)表示长度为 i,模 m 的余数为 j 的回文数字的个数,转移就是枚举 一个数字添加在前后,但是第一个 不能添加 0。 贪心。 记录每行最后一个 1 的位置 p[i], 然后枚举每一行,并将第一个符合 条件的行交换到这一行里来,同时 更新其他行。 考虑一下正方形旋转九十度之后就 会得到和原来相同的正方形,这样 角度上下界即是 0~90,而这其中 让最远距离点对放在对角线上是最 优解,其他位置的值都比此时要大, 所以在 0~90 之间答案是满足凹凸 性的,对角度三分之后,将点的坐 标变换为旋转相应角度下的坐标即 转化为平行于 x 轴和 y 轴的问题, 然后只要找出最大最小的 x 和 y 坐 标,最大的差值即为此角度下的最 小正方形边长。 01 分数规划、最短路 bellman_ford 求负环。 要求的是 sigma{li}/k 最大,那么可 以二分这个答案,然后用 mid 减去 每条边的长度,用 bellman_ford 判 断是否存在负环。 这题在 Poj 和 Acmlive 上都 AC 了, 但是在 Spoj 上却一直是 RE,不明 原因。可能是读入的问题。 离散化+线段树染色。
136 TRAN S
Transformation
用 f(c,l,r)表示串 B 的第 l~r 个字 符构成的子串能否由 c 通过若干 次变换得到,以及至少需要几次变 换来得到它。这样,状态转移方程 就不难写了(状态转移就是给定的 变换规则)。 算出了所有需要的 f 之后,再进行 一次简单的动态规划,记 g(i,j)为用 串 A 的前 i 个字符产生 B 的前

POJ2479Maximumsum解题报告

POJ2479Maximumsum解题报告

POJ2479Maximumsum解题报告Maximum sumTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 40596Accepted: 12663DescriptionGiven a set of n integers: A={a1, a2,..., an}, we define a function d(A) as below:Your task is to calculate d(A).InputThe input consists of T(<=30) test cases. The number of test cases (T) is given in the first line of the input.Each test case contains two lines. The first line is an integer n(2<=n<=50000). The second line contains n integers: a1, a2, ..., an. (|ai| <= 10000).There is an empty line after each case.OutputPrint exactly one line for each test case. The line should contain the integer d(A).Sample Input1101 -12 23 -34 -45 -5Sample Output13HintIn the sample, we choose {2,2,3,-3,4} and {5}, then we can get the answer.Huge input,scanf is recommended.Source,Author:Mathematica@ZSU题⽬⼤意:给定⼀个整数数字序列s,要求使两段不相交的⼦序列s1,s2的和最⼤题解:动态规划ls[i]表⽰以第i个元素结尾序列的最⼤值rs[i]表⽰以第i个元素开始序列的最⼤值rst[i]表⽰取i个元素能够达到的最⼤值所以有ls[i]=max(ls[i-1]+a[i], a[i]), rs[i]=max(rs[i+1]+a[i], a[i])rst[i]=max(rst(i+1), rs[i])所以最后的答案是s=max(s, ls[i]+rst(i+1))#include <stdio.h>#include <string.h>#include <cstdio>#include <iostream>using namespace std;const int maxn = 1e6+7, inf = -1e6+7;int a[maxn], ls[maxn], rs[maxn], s, rst[maxn]; int main(){int t, n;scanf("%d", &t);while (t--){s = 0;memset(ls, 0, sizeof(ls));memset(rs, 0, sizeof(rs));memset(rst, 0, sizeof(rst));scanf("%d", &n);for (int i=0; i<n; i++)scanf("%d", &a[i]);ls[0] = a[0];for (int i=1; i<n; i++) {ls[i] = max(ls[i-1]+a[i], a[i]);}rst[n-1] = rs[n-1] = a[n-1];for (int i=n-2; i>=0; i--){rs[i] = max(rs[i+1]+a[i], a[i]);rst[i] = max(rst[i+1], rs[i]);}s = inf;for (int i=0; i<n-1; i++) {s = max(s, ls[i]+rst[i+1]);}printf("%d\n", s);}return 0;}。

POJ题目分类

POJ题目分类

1000 A+B Problem 送分题1001 Exponentiation 高精度1003 Hangover 送分题1004 Financial Management 送分题1005 I Think I Need a Houseboat 几何1006 Biorhythms 送分题1007 DNA Sorting 送分题1008 Maya Calendar 日期处理1010 STAMPS 搜索+DP1011 Sticks 搜索1012 Joseph 模拟/数学方法1014 Dividing 数论/DP?/组合数学->母函数?1015 Jury Compromise DP1016 Numbers That Count 送分题1017 Packets 贪心1018 Communication System 贪心1019 Number Sequence 送分题1020 Anniversary Cake 搜索1023 The Fun Number System 数论1025 Department 模拟1026 Cipher 组合数学1027 The Same Game 模拟1028 Web Navigation 送分题1031 Fence 计算几何1034 The dog task 计算几何1037 A decorative fence DP/组合数学1039 Pipe 几何1042 Gone Fishing 贪心/DP1045 Bode Plot 送分题(用物理知识)1046 Color Me Less 送分题1047 Round and Round We Go 高精度1048 Follow My Logic 模拟1049 Microprocessor Simulation 模拟1050 To the Max DP1053 Set Me 送分题1054 The Troublesome Frog 搜索1060 Modular multiplication of polynomials 高精度1061 青蛙的约会数论1062 昂贵的聘礼DP1064 Cable master DP/二分查找1065 Wooden Sticks DP1067 取石子游戏博弈论1068 Parencodings 送分题1069 The Bermuda Triangle 搜索1070 Deformed Wheel 几何1071 Illusive Chase 送分题1072 Puzzle Out 搜索1073 The Willy Memorial Program 模拟1074 Parallel Expectations DP1075 University Entrance Examination 模拟1080 Human Gene Functions DP->LCS变形1082 Calendar Game 博弈论1084 Square Destroyer 搜索?1085 Triangle War 博弈论1086 Unscrambling Images 模拟?1087 A Plug for UNIX 图论->最大流1088 滑雪DFS/DP1090 Chain ->格雷码和二进制码的转换1091 跳蚤数论1092 Farmland 几何1093 Formatting Text DP1094 Sorting It All Out 图论->拓扑排序1095 Trees Made to Order 组合数学1096 Space Station Shielding 送分题1097 Roads Scholar 图论1098 Robots 模拟1099 Square Ice 送分题1100 Dreisam Equations 搜索1101 The Game 搜索->BFS1102 LC-Display 送分题1103 Maze 模拟1104 Robbery 递推1106 Transmitters 几何1107 W's Cipher 送分题1110 Double Vision 搜索1111 Image Perimeters 搜索1112 Team Them Up! DP1113 Wall 计算几何->convex hull1119 Start Up the Startup 送分题1120 A New Growth Industry 模拟1122 FDNY to the Rescue! 图论->Dijkstra 1125 Stockbroker Grapevine 图论->Dijkstra 1128 Frame Stacking 搜索1129 Channel Allocation 搜索(图的最大独立集)1131 Octal Fractions 高精度1135 Domino Effect 图论->Dijkstra1137 The New Villa 搜索->BFS1141 Brackets Sequence DP1142 Smith Numbers 搜索1143 Number Game 博弈论1147 Binary codes 构造1148 Utopia Divided 构造1149 PIGS 图论->网络流1151 Atlantis 计算几何->同等安置矩形的并的面积->离散化1152 An Easy Problem! 数论1157 LITTLE SHOP OF FLOWERS DP1158 TRAFFIC LIGHTS 图论->Dijkstra变形1159 Palindrome DP->LCS1160 Post Office DP1161 Walls 图论1162 Building with Blocks 搜索1163 The Triangle DP1170 Shopping Offers DP1177 Picture 计算几何->同等安置矩形的并的周长->线段树1179 Polygon DP1180 Batch Scheduling DP1182 食物链数据结构->并查集1183 反正切函数的应用搜索1184 聪明的打字员搜索1185 炮兵阵地DP->数据压缩1187 陨石的秘密DP(BalkanOI99 Par的拓展)1189 钉子和小球递推?1190 生日蛋糕搜索/DP1191 棋盘分割DP1192 最优连通子集图论->无负权回路的有向图的最长路->BellmanFord 1193 内存分配模拟1194 HIDDEN CODES 搜索+DP1197 Depot 数据结构->Young T ableau1201 Intervals 贪心/图论->最长路->差分约束系统1202 Family 高精度1209 Calendar 日期处理1217 FOUR QUARTERS 递推1218 THE DRUNK JAILER 送分题1233 Street Crossing 搜索->BFS1245 Programmer, Rank Thyself 送分题1247 Magnificent Meatballs 送分题1248 Safecracker 搜索1250 T anning Salon 送分题1251 Jungle Roads 图论->最小生成树1271 Nice Milk 计算几何1273 Drainage Ditches 图论->最大流1274 The Perfect Stall 图论->二分图的最大匹配1275 Cashier Employment 图论->差分约束系统->无负权回路的有向图的最长路->Bellman-Ford1280 Game 递推1281 MANAGER 模拟1286 Necklace of Beads 组合数学->Polya定理1288 Sly Number 数论->解模线性方程组1293 Duty Free Shop DP1298 The Hardest Problem Ever 送分题1316 Self Numbers 递推同Humble Number一样1322 Chocolate 递推/组合数学1323 Game Prediction 贪心1324 Holedox Moving BFS+压缩储存1325 Machine Schedule 图论->二分图的最大匹配1326 Mileage Bank 送分题1327 Moving Object Recognition 模拟?1328 Radar Installation 贪心(差分约束系统的特例)1338 Ugly Numbers 递推(有O(n)算法)1364 King 图论->无负权回路的有向图的最长路->BellmanFord1370 Gossiping (数论->模线性方程有无解的判断)+(图论->DFS)2184 Cow Exhibition DP2190 ISBN 送分题2191 Mersenne Composite Numbers 数论2192 Zipper DP->LCS变形2193 Lenny's Lucky Lotto Lists DP2194 Stacking Cylinders 几何2195 Going Home 图论->二分图的最大权匹配2196 Specialized Four-Digit Numbers 送分题2197 Jill's Tour Paths 图论->2199 Rate of Return 高精度2200 A Card Trick 模拟2210 Metric Time 日期处理2239 Selecting Courses 图论->二分图的最大匹配2243 Knight Moves 搜索->BFS2247 Humble Numbers 递推(最优O(n)算法)2253 Frogger 图论->Dijkstra变形(和1295是一样的)2254 Globetrotter 几何2261 France '98 递推2275 Flipping Pancake 构造2284 That Nice Euler Circuit 计算几何2289 Jamie's Contact Groups 图论->网络流?2291 Rotten Ropes 送分题2292 Optimal Keypad DP2299 Ultra-QuickSort 排序->归并排序2304 Combination Lock 送分题2309 BST 送分题2311 Cutting Game 博弈论2312 Battle City 搜索->BFS2314 POJ language 模拟2315 Football Game 几何2346 Lucky tickets 组合数学2351 Time Zones 时间处理2379 ACM Rank T able 模拟+排序2381 Random Gap 数论2385 Apple Catching DP(像NOI98“免费馅饼”)2388 Who's in the Middle 送分题(排序)2390 Bank Interest 送分题2395 Out of Hay 图论->Dijkstra变形2400 Supervisor, Supervisee 图论->二分图的最大权匹配?2403 Hay Points 送分题2409 Let it Bead 组合数学->Polya定理2416 Return of the Jedi 图论->2417 Discrete Logging 数论2418 Hardwood Species 二分查找2419 Forests 枚举2421 Constructing Roads 图论->最小生成树2423 The Parallel Challenge Ballgame 几何2424 Flo's Restaurant 数据结构->堆2425 A Chess Game 博弈论2426 Remainder BFS2430 Lazy Cows DP->数据压缩1375 Intervals 几何1379 Run Away 计算几何->1380 Equipment Box 几何1383 Labyrinth 图论->树的最长路1394 Railroad 图论->Dijkstra1395 Cog-Wheels 数学->解正系数的线性方程组1408 Fishnet 几何1411 Calling Extraterrestrial Intelligence Again 送分题1430 Binary Stirling Numbers 日期处理1431 Calendar of Maya 模拟1432 Decoding Morse Sequences DP1434 Fill the Cisterns! 计算几何->离散化/1445 Random number 数据结构->碓1447 Ambiguous Dates 日期处理1450 Gridland 图论(本来TSP问题是NP难的,但这个图比较特殊,由现成的构造方法)1458 Common Subsequence DP->LCS1459 Power Network 图论->最大流1462 Random Walk 模拟+解线性方程组1463 Strategic game 贪心1466 Girls and Boys 图论->n/a1469 COURSES 贪心1475 Pushing Boxes DP1476 Always On the Run 搜索->BFS1480 Optimal Programs 搜索->BFS1481 The Die Is Cast 送分题1482 It's not a Bug, It's a Feature! 搜索->BFS1483 Going in Circles on Alpha Centauri 模拟1484 Blowing Fuses 送分题1485 Fast Food DP(似乎就是ioi2000的postoffice)1486 Sorting Slides 图论->拓扑排序1505 Copying Books DP+二分查找1510 Hares and Foxes 数论1512 Keeps Going and Going and ... 模拟1513 Scheduling Lectures DP1514 Metal Cutting 几何1515 Street Directions 图论->把一个无向连通图改造成为有向强连通图1517 u Calculate e 送分题1518 Problem Bee 几何1519 Digital Roots 送分题(位数可能很大)1520 Scramble Sort 排序1547 Clay Bully 送分题1555 Polynomial Showdown 送分题(非常阴险)1563 The Snail 送分题1601 Pizza Anyone? 搜索1604 Just the Facts 送分题1605 Horse Shoe Scoring 几何1606 Jugs 数论/搜索1631 Bridging signals DP+二分查找1632 Vase collection 图论->最大完全图1633 Gladiators DP1634 Who's the boss? 排序1635 Subway tree systems 图论->不同表示法的二叉树判同1637 Sightseeing tour 图论->欧拉回路1638 A number game 博弈论1639 Picnic Planning 图论->1641 Rational Approximation 数论1646 Double Trouble 高精度1654 Area 几何1657 Distance on Chessboard 送分题1658 Eva's Problem 送分题1660 Princess FroG 构造1661 Help Jimmy DP1663 Number Steps 送分题1664 放苹果组合数学->递推1677 Girls' Day 送分题1688 Dolphin Pool 计算几何1690 (Your)((Term)((Project))) 送分题1691 Painting A Board 搜索/DP1692 Crossed Matchings DP1693 Counting Rectangles 几何1694 An Old Stone Game 博弈论?1695 Magazine Delivery 图论->1712 Flying Stars DP1713 Divide et unita 搜索1714 The Cave 搜索/DP1717 Dominoes DP1718 River Crossing DP1719 Shooting Contest 贪心1729 Jack and Jill 图论->1730 Perfect Pth Powers 数论1732 Phone numbers DP1734 Sightseeing trip 图论->Euler回路1738 An old Stone Game 博弈论?1741 Tree 博弈论?1745 Divisibility DP1751 Highways 图论->1752 Advertisement 贪心/图论->差分约束系统1753 Flip Game 搜索->BFS1755 Triathlon 计算几何?1770 Special Experiment 树形DP1771 Elevator Stopping Plan DP1772 New Go Game 构造?1773 Outernet 模拟1774 Fold Paper Strips 几何1775 Sum of Factorials 送分题1776 T ask Sequences DP1777 Vivian's Problem 数论1870 Bee Breeding 送分题1871 Bullet Hole 几何1872 A Dicey Problem BFS1873 The Fortified Forest 几何+回溯1874 Trade on Verweggistan DP1875 Robot 几何1876 The Letter Carrier's Rounds 模拟1877 Flooded! 数据结构->堆1879 Tempus et mobilius Time and motion 模拟+组合数学->Polya定理1882 Stamps 搜索+DP1883 Theseus and the Minotaur 模拟1887 Testing the CATCHER DP1889 Package Pricing DP1893 Monitoring Wheelchair Patients 模拟+几何1915 Knight Moves 搜索->BFS1916 Rat Attack 数据结构->?1936 All in All DP?1946 Cow Cycling DP1947 Rebuilding Roads 二分1985 Cow Marathon 图论->有向无环图的最长路1995 Raising Modulo Numbers 数论->大数的幂求余2049 Finding Nemo 图论->最短路2050 Searching the Web 模拟(需要高效实现)2051 Argus 送分题(最好用堆,不用也可以过)2054 Color a Tree 贪心2061 Pseudo-random Numbers 数论2080 Calendar 日期处理2082 Terrible Sets 分治/2083 Fractal 递归2084 Game of Connections 递推(不必高精度)2105 IP Address 送分题2115 C Looooops 数论->解模线性方程2136 Vertical Histogram 送分题2165 Gunman 计算几何2179 Inlay Cutters 枚举2181 Jumping Cows 递推2182 Lost Cows ->线段树/=============================================1370 Gossiping (数论->模线性方程有无解的判断)+(图论->DFS)1090 Chain ->格雷码和二进制码的转换2182 Lost Cows ->线段树/2426 Remainder BFS1872 A Dicey Problem BFS1324 Holedox Moving BFS+压缩储存1088 滑雪DFS/DP1015 Jury Compromise DP1050 To the Max DP1062 昂贵的聘礼DP1065 Wooden Sticks DP1074 Parallel Expectations DP1093 Formatting Text DP1112 Team Them Up! DP1141 Brackets Sequence DP1157 LITTLE SHOP OF FLOWERS DP1160 Post Office DP1163 The Triangle DP1170 Shopping Offers DP1179 Polygon DP1180 Batch Scheduling DP1191 棋盘分割DP1293 Duty Free Shop DP2184 Cow Exhibition DP2193 Lenny's Lucky Lotto Lists DP2292 Optimal Keypad DP1432 Decoding Morse Sequences DP1475 Pushing Boxes DP1513 Scheduling Lectures DP1633 Gladiators DP1661 Help Jimmy DP1692 Crossed Matchings DP1712 Flying Stars DP1717 Dominoes DP1718 River Crossing DP1732 Phone numbers DP1745 Divisibility DP1771 Elevator Stopping Plan DP1776 T ask Sequences DP1874 Trade on Verweggistan DP1887 Testing the CATCHER DP1889 Package Pricing DP1946 Cow Cycling DP1187 陨石的秘密DP(BalkanOI99 Par的拓展)1485 Fast Food DP(似乎就是ioi2000的postoffice) 2385 Apple Catching DP(像NOI98“免费馅饼”) 1064 Cable master DP/二分查找1037 A decorative fence DP/组合数学1936 All in All DP?1505 Copying Books DP+二分查找1631 Bridging signals DP+二分查找1159 Palindrome DP->LCS1458 Common Subsequence DP->LCS1080 Human Gene Functions DP->LCS变形2192 Zipper DP->LCS变形1185 炮兵阵地DP->数据压缩2430 Lazy Cows DP->数据压缩1067 取石子游戏博弈论1082 Calendar Game 博弈论1085 Triangle War 博弈论1143 Number Game 博弈论2311 Cutting Game 博弈论2425 A Chess Game 博弈论1638 A number game 博弈论1694 An Old Stone Game 博弈论?1738 An old Stone Game 博弈论?1741 Tree 博弈论?2083 Fractal 递归1104 Robbery 递推1217 FOUR QUARTERS 递推1280 Game 递推2261 France '98 递推2181 Jumping Cows 递推1316 Self Numbers 递推同Humble Number一样2084 Game of Connections 递推(不必高精度) 1338 Ugly Numbers 递推(有O(n)算法)2247 Humble Numbers 递推(最优O(n)算法)1322 Chocolate 递推/组合数学1189 钉子和小球递推?1947 Rebuilding Roads 二分2418 Hardwood Species 二分查找2082 Terrible Sets 分治/1001 Exponentiation 高精度1047 Round and Round We Go 高精度1060 Modular multiplication of polynomials 高精度1131 Octal Fractions 高精度1202 Family 高精度2199 Rate of Return 高精度1646 Double Trouble 高精度1147 Binary codes 构造1148 Utopia Divided 构造2275 Flipping Pancake 构造1660 Princess FroG 构造1772 New Go Game 构造?1005 I Think I Need a Houseboat 几何1039 Pipe 几何1070 Deformed Wheel 几何1092 Farmland 几何1106 Transmitters 几何2194 Stacking Cylinders 几何2254 Globetrotter 几何2315 Football Game 几何2423 The Parallel Challenge Ballgame 几何1375 Intervals 几何1380 Equipment Box 几何1408 Fishnet 几何1514 Metal Cutting 几何1518 Problem Bee 几何1605 Horse Shoe Scoring 几何1654 Area 几何1693 Counting Rectangles 几何1774 Fold Paper Strips 几何1871 Bullet Hole 几何1875 Robot 几何1873 The Fortified Forest 几何+回溯1031 Fence 计算几何1034 The dog task 计算几何1271 Nice Milk 计算几何2284 That Nice Euler Circuit 计算几何1688 Dolphin Pool 计算几何2165 Gunman 计算几何1755 Triathlon 计算几何?1379 Run Away 计算几何->1113 Wall 计算几何->convex hull1434 Fill the Cisterns! 计算几何->离散化/1151 Atlantis 计算几何->同等安置矩形的并的面积->离散化1177 Picture 计算几何->同等安置矩形的并的周长->线段树2419 Forests 枚举2179 Inlay Cutters 枚举1025 Department 模拟1027 The Same Game 模拟1048 Follow My Logic 模拟1049 Microprocessor Simulation 模拟1073 The Willy Memorial Program 模拟1075 University Entrance Examination 模拟1098 Robots 模拟1103 Maze 模拟1120 A New Growth Industry 模拟1193 内存分配模拟1281 MANAGER 模拟2200 A Card Trick 模拟2314 POJ language 模拟1431 Calendar of Maya 模拟1483 Going in Circles on Alpha Centauri 模拟1512 Keeps Going and Going and ... 模拟1773 Outernet 模拟1876 The Letter Carrier's Rounds 模拟1883 Theseus and the Minotaur 模拟2050 Searching the Web 模拟(需要高效实现)1012 Joseph 模拟/数学方法1086 Unscrambling Images 模拟?1327 Moving Object Recognition 模拟?1893 Monitoring Wheelchair Patients 模拟+几何1462 Random Walk 模拟+解线性方程组2379 ACM Rank T able 模拟+排序1879 Tempus et mobilius Time and motion 模拟+组合数学->Polya定理1520 Scramble Sort 排序1634 Who's the boss? 排序2299 Ultra-QuickSort 排序->归并排序1008 Maya Calendar 日期处理1209 Calendar 日期处理2210 Metric Time 日期处理1430 Binary Stirling Numbers 日期处理1447 Ambiguous Dates 日期处理2080 Calendar 日期处理2351 Time Zones 时间处理1770 Special Experiment 树形DP1916 Rat Attack 数据结构->?1197 Depot 数据结构->Young T ableau1182 食物链数据结构->并查集2424 Flo's Restaurant 数据结构->堆1877 Flooded! 数据结构->堆1445 Random number 数据结构->碓1023 The Fun Number System 数论1061 青蛙的约会数论1091 跳蚤数论1152 An Easy Problem! 数论2191 Mersenne Composite Numbers 数论2381 Random Gap 数论2417 Discrete Logging 数论1510 Hares and Foxes 数论1641 Rational Approximation 数论1730 Perfect Pth Powers 数论1777 Vivian's Problem 数论2061 Pseudo-random Numbers 数论1014 Dividing 数论/DP?/组合数学->母函数?1606 Jugs 数论/搜索1995 Raising Modulo Numbers 数论->大数的幂求余2115 C Looooops 数论->解模线性方程1288 Sly Number 数论->解模线性方程组1395 Cog-Wheels 数学->解正系数的线性方程组1000 A+B Problem 送分题1003 Hangover 送分题1004 Financial Management 送分题1006 Biorhythms 送分题1007 DNA Sorting 送分题1016 Numbers That Count 送分题1019 Number Sequence 送分题1028 Web Navigation 送分题1046 Color Me Less 送分题1053 Set Me 送分题1068 Parencodings 送分题1071 Illusive Chase 送分题1096 Space Station Shielding 送分题1099 Square Ice 送分题1102 LC-Display 送分题1107 W's Cipher 送分题1119 Start Up the Startup 送分题1218 THE DRUNK JAILER 送分题1245 Programmer, Rank Thyself 送分题1247 Magnificent Meatballs 送分题1250 T anning Salon 送分题1298 The Hardest Problem Ever 送分题1326 Mileage Bank 送分题2190 ISBN 送分题2196 Specialized Four-Digit Numbers 送分题2291 Rotten Ropes 送分题2304 Combination Lock 送分题2309 BST 送分题2390 Bank Interest 送分题2403 Hay Points 送分题1411 Calling Extraterrestrial Intelligence Again 送分题1481 The Die Is Cast 送分题1484 Blowing Fuses 送分题1517 u Calculate e 送分题1547 Clay Bully 送分题1563 The Snail 送分题1604 Just the Facts 送分题1657 Distance on Chessboard 送分题1658 Eva's Problem 送分题1663 Number Steps 送分题1677 Girls' Day 送分题1690 (Your)((Term)((Project))) 送分题1775 Sum of Factorials 送分题1870 Bee Breeding 送分题2105 IP Address 送分题2136 Vertical Histogram 送分题1555 Polynomial Showdown 送分题(非常阴险) 2388 Who's in the Middle 送分题(排序)1519 Digital Roots 送分题(位数可能很大)1045 Bode Plot 送分题(用物理知识)2051 Argus 送分题(最好用堆,不用也可以过) 1011 Sticks 搜索1020 Anniversary Cake 搜索1054 The Troublesome Frog 搜索1069 The Bermuda Triangle 搜索1072 Puzzle Out 搜索1100 Dreisam Equations 搜索1110 Double Vision 搜索1111 Image Perimeters 搜索1128 Frame Stacking 搜索1142 Smith Numbers 搜索1162 Building with Blocks 搜索1183 反正切函数的应用搜索1184 聪明的打字员搜索1248 Safecracker 搜索1601 Pizza Anyone? 搜索1713 Divide et unita 搜索1129 Channel Allocation 搜索(图的最大独立集)1190 生日蛋糕搜索/DP1691 Painting A Board 搜索/DP1714 The Cave 搜索/DP1084 Square Destroyer 搜索?1010 STAMPS 搜索+DP1194 HIDDEN CODES 搜索+DP1882 Stamps 搜索+DP1101 The Game 搜索->BFS1137 The New Villa 搜索->BFS1233 Street Crossing 搜索->BFS2243 Knight Moves 搜索->BFS2312 Battle City 搜索->BFS1476 Always On the Run 搜索->BFS1480 Optimal Programs 搜索->BFS1482 It's not a Bug, It's a Feature! 搜索->BFS 1753 Flip Game 搜索->BFS1915 Knight Moves 搜索->BFS1017 Packets 贪心1018 Communication System 贪心1323 Game Prediction 贪心1463 Strategic game 贪心1469 COURSES 贪心1719 Shooting Contest 贪心2054 Color a Tree 贪心1328 Radar Installation 贪心(差分约束系统的特例)1042 Gone Fishing 贪心/DP1752 Advertisement 贪心/图论->差分约束系统1201 Intervals 贪心/图论->最长路->差分约束系统1097 Roads Scholar 图论1161 Walls 图论1450 Gridland 图论(本来TSP问题是NP难的,但这个图比较特殊,由现成的构造方法)2197 Jill's Tour Paths 图论->2416 Return of the Jedi 图论->1639 Picnic Planning 图论->1695 Magazine Delivery 图论->1729 Jack and Jill 图论->1751 Highways 图论->1122 FDNY to the Rescue! 图论->Dijkstra1125 Stockbroker Grapevine 图论->Dijkstra1135 Domino Effect 图论->Dijkstra1394 Railroad 图论->Dijkstra1158 TRAFFIC LIGHTS 图论->Dijkstra变形2395 Out of Hay 图论->Dijkstra变形2253 Frogger 图论->Dijkstra变形(和1295是一样的)1734 Sightseeing trip 图论->Euler回路1466 Girls and Boys 图论->n/a1515 Street Directions 图论->把一个无向连通图改造成为有向强连通图1635 Subway tree systems 图论->不同表示法的二叉树判同1275 Cashier Employment 图论->差分约束系统->无负权回路的有向图的最长路->Bellman-Ford1274 The Perfect Stall 图论->二分图的最大匹配1325 Machine Schedule 图论->二分图的最大匹配2239 Selecting Courses 图论->二分图的最大匹配2195 Going Home 图论->二分图的最大权匹配2400 Supervisor, Supervisee 图论->二分图的最大权匹配?1637 Sightseeing tour 图论->欧拉回路1383 Labyrinth 图论->树的最长路1094 Sorting It All Out 图论->拓扑排序1486 Sorting Slides 图论->拓扑排序1149 PIGS 图论->网络流2289 Jamie's Contact Groups 图论->网络流?1192 最优连通子集图论->无负权回路的有向图的最长路->BellmanFord 1364 King 图论->无负权回路的有向图的最长路->BellmanFord1985 Cow Marathon 图论->有向无环图的最长路1087 A Plug for UNIX 图论->最大流1273 Drainage Ditches 图论->最大流1459 Power Network 图论->最大流1632 Vase collection 图论->最大完全图2049 Finding Nemo 图论->最短路1251 Jungle Roads 图论->最小生成树2421 Constructing Roads 图论->最小生成树1026 Cipher 组合数学1095 Trees Made to Order 组合数学2346 Lucky tickets 组合数学1286 Necklace of Beads 组合数学->Polya定理2409 Let it Bead 组合数学->Polya定理1664 放苹果组合数学->递推。

1061 北大poj 解题报告

1061 北大poj 解题报告

• 证明
• 那么现在的问题就是求出方程
• • • •
(n-m)*t+Lp=x-y 的任意一组解 T,P G=L/(n-m,L) 则 (T%G+G)%G就是所求的答案
注意 • C++中的%运算并不是数学上的求模 • (-1)%2=-1
假设:你不知道扩展的Euclid 算法
• 你应该已经掌握 Euclid 算法 int gcd(int m,int n) // Euclid { int r=(m%n+n)%n; while(r) {m=n;n=r;r=m%n;} return n; }
• 设 u(j)=x(j)*u(0)+y(j)*u(1) u(j+1)= u(j-1)-q(j-1)*u(j) = u(j-1)-q(j-1)*(x(j)*u(0)+y(j)*u(1)) =u(j-1)-q(j-1)*x(j)*u(0)-q(j-1)*y(j)*u(1) =(x(j-1)-q(j-1)*x(j) )*u(0) + (y(j-1)-q(j-1)*y(j) )*u(1) 由此求出x(j+1),y(j+1) x(k+1),y(k+1)即为所求x,y
• 其实这时就靠数学功底了。
• 定理:设a,b为不全为零的整数,那么 存在x,y Z,使得 a*x+b*y=gcd(a,b) • 证明思路: • 考虑集合S={a*x+b*y | x,y Z}
• (1) m,n S => m+n ,m-n S • (2) 设S中最小的正整数为d,则 x S <=> d | x
写在后面的话
• 数学能力 (1)抽象 将问题抽象成数学问题是解决许多问题 的关键。 (2)知识 知识是能力的基础

北大 poj acm题目推荐50题

北大 poj acm题目推荐50题

-北大poj acm题目推荐50题POJ == 北京大学ACM在线评测系统/JudgeOnline1. 标记难和稍难的题目大家可以看看,思考一下,不做要求,当然有能力的同学可以直接切掉。

2. 标记为A and B 的题目是比较相似的题目,建议大家两个一起做,可以对比总结,且二者算作一个题目。

3. 列表中大约有70个题目。

大家选做其中的50道,且每类题目有最低数量限制。

4. 这里不少题目在BUPT ACM FTP 上面都有代码,请大家合理利用资源。

5. 50个题目要求每个题目都要写总结,养成良好的习惯。

6. 这50道题的规定是我们的建议,如果大家有自己的想法请与我们Email 联系。

7. 建议使用C++ 的同学在POJ 上用G++ 提交。

8. 形成自己编写代码的风格,至少看上去美观,思路清晰(好的代码可以很清楚反映出解题思路)。

9. 这个列表的目的在于让大家对各个方面的算法有个了解,也许要求有些苛刻,教条,请大家谅解,这些是我们这些年的经验总结,所以也请大家尊重我们的劳动成果。

10. 提交要求:一个总文件夹名为bupt0xx (即你的比赛帐号), 这个文件夹内有各个题目类别的子目录(文件夹),将相应的解题报告放入对应类别的文件夹。

在本学期期末,小学期开始前,将该文件夹的压缩包发至buptacm@。

对于每个题目只要求一个POJxxxx.cpp 或POJxxxx.java (xxxx表示POJ该题题号) 的文件,注意不要加入整个project 。

11. 如果有同学很早做完了要求的题目,请尽快和我们联系,我们将指导下一步的训练。

下面是一个解题报告的范例:例如:POJ1000.cpp//考查点:会不会编程序。

//思路:此题要求输入两个数,输出两个数的和,我用scanf 和printf。

//提交情况:Wrong Answer 1次,忘了写printf()。

Compile Error 2次,选错了语言,由于C++ 和G++ 在iostream.h 的不用引用方法;少一个大括号。

POJ1456Supermarket题解

POJ1456Supermarket题解

POJ1456Supermarket题解思维题。

关键在于如何想到⽤堆来维护贪⼼的策略。

⾸先肯定是卖出的利润越⼤的越好,但有可能当前这天选定了利润最⼤的很久才过期⽽利润第⼆⼤的第⼆天就过期,这时的策略就不优了。

所以我们必须动态改变策略,使整体最优。

先按过期时间排序,按顺序遍历,对于每⼀个商品,如果过期时间⼤于当前已决定要卖的商品的个数,那么这个东西就也要被卖出。

如果过期时间等于当前已决定要卖的商品的个数,那么这个商品是否要被卖出取决于利润是否⼤于已决定要卖的商品的最⼩利润,如果是那么决策显然会变得更优,替换掉最⼩的商品即可。

根据以上的分析,⼩根堆明显有利于我们维护这样的决策。

这⾥的⼩根堆实际上是⼀个按时间轴顺序排好的“卖出清单”,始终保持了决策的最优性。

总结⼀下,本题的贪⼼关键在于这天没过期就先卖出去,等碰见利润⽐它⼤的就把它顶掉。

#include <cstdio>#include <algorithm>#include <queue>using namespace std;int n;struct P{int p,d;}a[10005];priority_queue<int,vector<int>,greater<int> > Q;bool cmp(P x,P y) {return x.d==y.d?x.p<y.p:x.d<y.d;}int main(){while(~scanf("%d",&n)){int siz=0,ans=0;for(int i=1;i<=n;++i) scanf("%d%d",&a[i].p,&a[i].d);sort(a+1,a+n+1,cmp);for(int i=1;i<=n;++i){if(a[i].d==siz){if(a[i].p>Q.top()) {Q.pop(); Q.push(a[i].p);}}else if(a[i].d>siz) {Q.push(a[i].p);siz++;}}while(!Q.empty()) {ans+=Q.top(); Q.pop();}printf("%d\n",ans);}return 0;}。

各大OJ题目归类

各大OJ题目归类

各大OJ题目归类—————————–最优化问题————————————- ———————-动态规划SOJ1162 I-KeyboardSOJ2096 Maximum SubmatrixSOJ2111 littleken bgSOJ2505 The County FairSOJ2818 QQ音速SOJ2469 Exploring PyramidsSOJ1833 Base NumbersSOJ2009 Zeros and OnesSOJ2032 The Lost HouseSOJ2289 A decorative fenceSOJ2089 lykooSOJ2440 The days in fzkSOJ2718 BookshelfSOJ2722 Treats for the Cows(二维状态,0维决策)SOJ2726 Deck of CardsSOJ2729 Space ElevatorSOJ2730 Lazy CowsSOJ2702 AlannaSOJ2713 Cut the SequenceSOJ2768 BombSOJ2779 Find the max (I) (最大M子段和问题)SOJ2796 Letter Deletion(DP基础题,最长公共子序列问题) SOJ2800 三角形SOJ2804 Longest Ordered Subsequence (II)SOJ2896 Alphacode (动态规划简单题)SOJ2930 积木城堡SOJ3037 Painting the ballsSOJ3104 Game(注意大数运算,高精度)SOJ3264 Evil GameSOJ3300 Stockholm Coins(背包问题)SOJ3360 Buying Hay(背包问题)SOJ3531 Number Pyramids(背包问题)—————-状态DPSOJ2089 lykooSOJ2819 AderSOJ2842 The TSP problemSOJ3025 Artillery(状态DP)SOJ3088 windy’s cake VIIISOJ3259 Counting numbersSOJ3262 Square Fields(二分+状态DP)SOJ3371 Mixed Up Cows—————最优化之排序(思考两个元素之间的先后关系,以此得出一个二元比较关系,并验证此关系可传递,反对称,进而排序)SOJ2509 The Milk QueueSOJ2547 cardsSOJ2850 Protecting the FlowersSOJ2957 Setting ProblemsSOJ3167 ComputerSOJ3331 Cards(2547加强版)SOJ3327 Dahema’s Computer(通过此题学会排序)—————–最优化之必要条件枚举(思考最优解所具有的性质,得出最优解的一个强必要条件,在此基础上枚举)SOJ3317 FGJ’s PlaneSOJ3429 Food portion sizes——————————–贪心—————————————SOJ1078 BlueEyes’ ScheduleSOJ1203 Pass-MurailleSOJ1673 Gone FishingSOJ2645 Buy One Get One FreeSOJ2701 In a CycleSOJ2876 Antimonotonicity(经典模型O(n)算法)SOJ3343 Tower——————————–搜索—————————————SOJ1626 squareSOJ2061 8 puzzleSOJ2485 SudokuSOJ1045 SticksSOJ2736 FliptileSOJ2771 Collecting StonesSOJ2715 Maze BreakSOJ2829 binary strings(双向BFS)SOJ3330 Windy’s Matrix(BFS)——————————–DFA—————————————-—————状态矩阵+DFA:SOJ1826 Number SequenceSOJ2552 Number of TilingsSOJ2919 Matrix Power Series (学习矩阵的快速乘法从此开始)SOJ2920 Magic BeanSOJ3021 Quad TilingSOJ3046 Odd Loving BakersSOJ3176 E-stringSOJ3246 Tiling a Grid With DominoesSOJ3323 K-Satisfied NumbersSOJ3337 Wqb’s Word—————-DFA+DPSOJ1112 Repeatless Numbers(DFA+二分)SOJ2913 Number SubstringSOJ2826 Apocalypse SomedaySOJ3030 DNA Sequence(AC自动机+矩阵二分)SOJ3128 windy和水星—水星数学家1SOJ3182 Windy numbers———————————图论———————————————————–最短路+最小生成树+强连通SOJ2832 Mars city(强连通分支,算法多多)SOJ2198 HighwaysSOJ3427 Dark roads(最小生成树,kruskal:快排+并查集)SOJ3346 Best Spot(最短路,N^3放心的写)SOJ3013 tree(树的最大—最小划分问题,二分+贪心,勉强算在图论里面吧。

POJ 300题训练计划

POJ 300题训练计划
poj1069,poj3322,poj1475,poj1924,poj2049,poj3426
广搜的状态优化
poj1768,poj1184,poj1872,poj1324,poj2046,poj1482
深搜的优化
poj3131,poj2870,poj2286
动态规划
需要用数据结构优化的动态规划
第6周
数论
poj2635, poj3292,poj1845,poj2115
计算方法
poj3273,poj3258,poj1905,poj3122
计算几何学
几何公式
第2周
叉积和点积的运用
poj2031,poj1039
多边型的简单算法和相关判定
poj1408,poj1584
凸包
poj2187,poj1113
第二阶段中级:
poj2754,poj3378,poj3017
四边形不等式理论、斜率优化
poj1160,poj1180,poj3709
较难的状态DP、插头DP
poj3133,poj1739,poj2411,poj1763
数学
组合数学
第6周
poj2888,poj2154
博奕论
poj3317,poj1085
计算几何学
半平面求交
第3周
poj1699
搜索的技巧和优化
poj3411,poj1724
记忆化搜索
poj3373,poj1691
动态规划
较为复杂的动态规划
第4周
poj1191,poj1054,poj3280,poj2029,poj2948,poj1925,poj3034
记录状态的动态规划
poj3254,poj2411,poj1185

poj dp题目列表

poj dp题目列表

[1]POJ 动态规划题目列表容易:1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1208, 1276, 1322, 1414, 1456, 1458, 1609, 1644, 1664, 1690, 1699, 1740(博弈), 1742, 1887, 1926(马尔科夫矩阵,求平衡), 1936, 1952, 1953, 1958, 1959, 1962, 1975, 1989, 2018, 2029, 2039, 2063, 2081, 2082, 2181, 2184, 2192, 2231, 2279, 2329, 2336, 2346, 2353, 2355, 2356, 2385, 2392, 2424,不易:1019, 1037, 1080, 1112, 1141, 1170, 1192, 1239, 1655, 1695, 1707, 1733(区间减法加并查集), 1737, 1837, 1850, 1920(加强版汉罗塔), 1934(全部最长公共子序列), 1937(计算几何), 1964(最大矩形面积,O(n)算法), 2138, 2151, 2161, 2178,推荐:1015, 1635, 1636(挺好的), 1671, 1682, 1692(优化), 1704, 1717, 1722, 1726, 1732, 1770, 1821, 1853, 1949, 2019, 2127, 2176, 2228, 2287, 2342, 2374, 2378, 2384, 24111015 Jury Compromise1029 False coin1036 Gangsters1037 A decorative fence1038 Bugs Integrated, Inc.1042 Gone Fishing1050 To the Max1062 昂贵的聘礼1074 Parallel Expectations1080 Human Gene Functions1088 滑雪1093 Formatting Text1112 Team Them Up!1141 Brackets Sequence1143 Number Game1157 LITTLE SHOP OF FLOWERS1159 Palindrome1160 Post Office1163 The Triangle1170 Shopping Offers1178 Camelot1179 Polygon1180 Batch Scheduling1185 炮兵阵地1187 陨石的秘密1189 钉子和小球1191 棋盘分割1192 最优连通子集1208 The Blocks Problem1239 Increasing Sequences1240 Pre-Post-erous!1276 Cash Machine1293 Duty Free Shop1322 Chocolate1323 Game Prediction1338 Ugly Numbers1390 Blocks1414 Life Line1432 Decoding Morse Sequences 1456 Supermarket1458 Common Subsequence1475 Pushing Boxes1485 Fast Food1505 Copying Books1513 Scheduling Lectures1579 Function Run Fun1609 Tiling Up Blocks1631 Bridging signals 2分+DP NLOGN 1633 Gladiators1635 Subway tree systems1636 Prison rearrangement1644 To Bet or Not To Bet1649 Market Place1651 Multiplication Puzzle1655 Balancing Act1661 Help Jimmy1664 放苹果1671 Rhyme Schemes1682 Clans on the Three Gorges 1690 (Your)((Term)((Project)))1691 Painting A Board1692 Crossed Matchings1695 Magazine Delivery1699 Best Sequence1704 Georgia and Bob1707 Sum of powers1712 Flying Stars1714 The Cave1717 Dominoes1718 River Crossing1722 SUBTRACT1726 Tango Tango Insurrection 1732 Phone numbers1733 Parity game1737 Connected Graph1740 A New Stone Game1742 Coins P1745 Divisibility1770 Special Experiment1771 Elevator Stopping Plan 1776 Task Sequences1821 Fence1837 Balance1848 Tree1850 Code1853 Cat1874 Trade on Verweggistan 1887 Testing the CATCHER 1889 Package Pricing1920 Towers of Hanoi1926 Pollution1934 Trip1936 All in All1937 Balanced Food1946 Cow Cycling1947 Rebuilding Roads1949 Chores1952 BUY LOW, BUY LOWER 1953 World Cup Noise1958 Strange Towers of Hanoi 1959 Darts1962 Corporative Network 1964 City Game1975 Median Weight Bead 1989 The Cow Lineup2018 Best Cow Fences2019 Cornfields2029 Get Many Persimmon Trees 2033 Alphacode2039 To and Fro2047 Concert Hall Scheduling 2063 Investment2081 Recaman's Sequence 2082 Terrible Sets2084 Game of Connections2127 Greatest Common Increasing Subsequence 2138 Travel Games2151 Check the difficulty of problems2152 Fire2161 Chandelier2176 Folding2178 Heroes Of Might And Magic2181 Jumping Cows2184 Cow Exhibition2192 Zipper2193 Lenny's Lucky Lotto Lists2228 Naptime2231 Moo Volume2279 Mr. Young's Picture Permutations2287 TianJi -- The Horse Racing2288 Islands and Bridges2292 Optimal Keypad2329 Nearest number - 22336 Ferry Loading II2342 Anniversary party2346 Lucky tickets2353 Ministry2355 Railway tickets2356 Find a multiple2374 Fence Obstacle Course2378 Tree Cutting2384 Harder Sokoban Problem2385 Apple Catching2386 Lake Counting2392 Space Elevator2397 Spiderman2411 Mondriaan's Dream2414 Phylogenetic Trees Inherited2424 Flo's Restaurant2430 Lazy Cows2915 Zuma3017 Cut the Sequence3028 Shoot-out3124 The Bookcase3133 Manhattan Wiring3345 Bribing FIPA3375 Network Connection3420 Quad Tiling ?/?cat=5[2]动态规划方法总结1. 按状态类型分写在前面:从状态类型分,并不表示一题只从属于一类。

Poj动态规划

Poj动态规划

[1]POJ 动态规划题目列表容易:1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1208, 1276, 1322, 1414, 1456, 1458, 1609, 1644, 1664, 1690, 1699, 1740(博弈), 1742, 1887, 1926(马尔科夫矩阵,求平衡), 1936,1952, 1953, 1958, 1959, 1962, 1975, 1989, 2018, 2029,2039, 2063, 2081, 2082,2181, 2184, 2192, 2231, 2279, 2329, 2336, 2346, 2353,2355, 2356, 2385, 2392, 2424,不易:1019,1037, 1080, 1112, 1141, 1170, 1192, 1239, 1655, 1695, 1707,1733(区间减法加并查集), 1737, 1837, 1850, 1920(加强版汉罗塔), 1934(全部最长公共子序列), 1937(计算几何), 1964(最大矩形面积,O(n)算法), 2138, 2151, 2161(烦,没写), 2178,推荐:1015, 1635, 1636(挺好的), 1671, 1682, 1692(优化), 1704, 1717, 1722, 1726, 1732, 1770, 1821, 1853, 1949, 2019, 2127, 2176, 2228, 2287, 2342, 2374, 2378, 2384, 2411状态DP树DP构造最优解四边形不等式单调队列1015 Jury Compromise1029 False coin1036 Gangsters1037 A decorative fence1038 Bugs Integrated, Inc.1042 Gone Fishing1050 To the Max1062 昂贵的聘礼1074 Parallel Expectations1080 Human Gene Functions1088 滑雪1093 Formatting Text1112 Team Them Up!1141 Brackets Sequence1143 Number Game1157 LITTLE SHOP OF FLOWERS1159 Palindrome1160 Post Office1163 The Triangle1170 Shopping Offers1178 Camelot1179 Polygon1180 Batch Scheduling1185 炮兵阵地1187 陨石的秘密1189 钉子和小球1191 棋盘分割1192 最优连通子集1208 The Blocks Problem1239 Increasing Sequences1240 Pre-Post-erous!1276 Cash Machine1293 Duty Free Shop1322 Chocolate1323 Game Prediction1338 Ugly Numbers1390 Blocks1414 Life Line1432 Decoding Morse Sequences 1456 Supermarket1458 Common Subsequence1475 Pushing Boxes1485 Fast Food1505 Copying Books1513 Scheduling Lectures1579 Function Run Fun1609 Tiling Up Blocks1631 Bridging signals 2分+DP NLOGN 1633 Gladiators1635 Subway tree systems1636 Prison rearrangement1644 To Bet or Not To Bet1649 Market Place1651 Multiplication Puzzle1655 Balancing Act1661 Help Jimmy1664 放苹果1671 Rhyme Schemes1682 Clans on the Three Gorges 1690 (Your)((Term)((Project)))1691 Painting A Board1692 Crossed Matchings 1695 Magazine Delivery 1699 Best Sequence1704 Georgia and Bob1707 Sum of powers1712 Flying Stars1714 The Cave1717 Dominoes1718 River Crossing1722 SUBTRACT1726 Tango Tango Insurrection 1732 Phone numbers1733 Parity game1737 Connected Graph1740 A New Stone Game 1742 Coins P1745 Divisibility1770 Special Experiment 1771 Elevator Stopping Plan 1776 Task Sequences1821 Fence1837 Balance1848 Tree1850 Code1853 Cat1874 Trade on Verweggistan 1887 Testing the CATCHER 1889 Package Pricing1920 Towers of Hanoi1926 Pollution1934 Trip1936 All in All1937 Balanced Food1946 Cow Cycling1947 Rebuilding Roads1949 Chores1952 BUY LOW, BUY LOWER 1953 World Cup Noise1958 Strange Towers of Hanoi 1959 Darts1962 Corporative Network 1964 City Game1975 Median Weight Bead 1989 The Cow Lineup2018 Best Cow Fences2019 Cornfields2029 Get Many Persimmon Trees2033 Alphacode2039 To and Fro2047 Concert Hall Scheduling2063 Investment2081 Recaman's Sequence2082 Terrible Sets2084 Game of Connections2127 Greatest Common Increasing Subsequence 2138 Travel Games2151 Check the difficulty of problems2152 Fire2161 Chandelier2176 Folding2178 Heroes Of Might And Magic2181 Jumping Cows2184 Cow Exhibition2192 Zipper2193 Lenny's Lucky Lotto Lists2228 Naptime2231 Moo Volume2279 Mr. Young's Picture Permutations2287 TianJi -- The Horse Racing2288 Islands and Bridges2292 Optimal Keypad2329 Nearest number - 22336 Ferry Loading II2342 Anniversary party2346 Lucky tickets2353 Ministry2355 Railway tickets2356 Find a multiple2374 Fence Obstacle Course2378 Tree Cutting2384 Harder Sokoban Problem2385 Apple Catching2386 Lake Counting2392 Space Elevator2397 Spiderman2411 Mondriaan's Dream2414 Phylogenetic Trees Inherited2424 Flo's Restaurant2430 Lazy Cows2915 Zuma3017 Cut the Sequence3028 Shoot-out3124 The Bookcase3133 Manhattan Wiring3345 Bribing FIPA3375 Network Connection3420 Quad Tiling ?/?cat=5[2]动态规划方法总结1. 按状态类型分写在前面:从状态类型分,并不表示一题只从属于一类。

POJ分类

POJ分类

POJ上一些题目在http://162.105.81.202/course/problemSolving/可以找到解题报告。

《算法艺术与信息学竞赛》的习题提示在网上可搜到一.动态规划参考资料:刘汝佳《算法艺术与信息学竞赛》《算法导论》推荐题目:/JudgeOnline/problem?id=1141简单/JudgeOnline/problem?id=2288中等,经典TSP问题/JudgeOnline/problem?id=2411中等,状态压缩DP/JudgeOnline/problem?id=1112中等/JudgeOnline/problem?id=1848中等,树形DP。

可参考《算法艺术与信息学竞赛》动态规划一节的树状模型/show_problem.php?pid=1234中等,《算法艺术与信息学竞赛》中的习题/JudgeOnline/problem?id=1947中等,《算法艺术与信息学竞赛》中的习题/JudgeOnline/problem?id=1946中等,《算法艺术与信息学竞赛》中的习题/JudgeOnline/problem?id=1737中等,递推/JudgeOnline/problem?id=1821中等,需要减少冗余计算/show_problem.php?pid=2561中等,四边形不等式的简单应用/JudgeOnline/problem?id=1038较难,状态压缩DP,《算法艺术与信息学竞赛》中有解答/JudgeOnline/problem?id=1390较难,《算法艺术与信息学竞赛》中有解答/JudgeOnline/problem?id=3017较难,需要配合数据结构优化(我的题目^_^)/JudgeOnline/problem?id=1682较难,写起来比较麻烦/JudgeOnline/problem?id=2047较难/JudgeOnline/problem?id=2152难,树形DP/JudgeOnline/problem?id=3028难,状态压缩DP,题目很有意思/JudgeOnline/problem?id=3124难/JudgeOnline/problem?id=2915非常难二.搜索参考资料:刘汝佳《算法艺术与信息学竞赛》推荐题目:/JudgeOnline/problem?id=1011简单,深搜入门题/JudgeOnline/problem?id=1324中等,广搜/JudgeOnline/problem?id=2044中等,广搜/JudgeOnline/problem?id=2286较难,广搜/JudgeOnline/problem?id=1945难,IDA*,迭代加深搜索,需要较好的启发函数/JudgeOnline/problem?id=2449难,可重复K最短路,A*。

1087 北大poj 解题报告,非常经典,超给力

1087 北大poj 解题报告,非常经典,超给力

1087A Plug For Unix张法睿2004-7-18Part I 题目1You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive(UNIX),which has an international mandate to make the freeflow of information and ideas on the Internet as cumbersome and bureaucratic as possible.Since the room was designed to accommodate reporters and journalists from around the world,it is equipped with electrical receptacles to suit the different shapes of plugs and voltages used by appliances in all of the countries that existed when the room was built.Unfortunately, the room was built many years ago when reporters used very few electric and electronic devices and is equipped with only one receptacle of each type.These days,like everyone else,reporters require many such devices to do their jobs: laptops,cell phones,tape recorders,pagers,coffee pots,microwave ovens,blow dryers,curling irons,tooth brushes,etc.Naturally,many of these devices can operate on batteries,but since the meeting is likely to be long and tedious,you want to be able to plug in as many as you can.Before the meeting begins,you gather up all the devices that the reporters would like to use,and attempt to set them up.You notice that some of the devices use plugs for which there is no receptacle.You wonder if these devices are from countries that didn’t exist when the room was built.For some receptacles,there are several devices that use the corresponding plug.For other receptacles,there are no devices that use the corresponding plug.In order to try to solve the problem you visit a nearby parts supply store.The store sells adapters that allow one type of plug to be used in a different type of outlet.Moreover,adapters are allowed to be plugged into other adapters.The store does not have adapters for all possible combinations of plugs and receptacles,but there is essentially an unlimited supply of the ones they do have.中文简述有最多100个插座,100件电器,100种转接头,试求最多能有多少件电器可以插在插座上,注意:转接头可以串联2Part II 分析3这是网络最大流问题的一个经典题目,如果我们假设每件电器都消耗消耗单位功率的能量,那么能插上的最多的电器数,和电网中能量流的最大值是等价的。

POJ 20 道线段树汇总

POJ 20 道线段树汇总

pojpku线段树题目20道汇总+简要算法+分类+难度来源:黑梦楠的日志难度系数分为从1 到 5 (只对初学者有用对大牛来讲这些题的难度系数都是0..)/JudgeOnline/problem?id=1151Atlantis 扫描线+离散化+线段树这是经典的扫描线求矩形面积交很好过没什么陷阱如果头一次接触扫描线那么难度系数大概算3吧如果熟练掌握扫描线难度系数为1难度系数***/JudgeOnline/problem?id=1177Picture 扫描线+线段树扫描线求矩形周长的并比求面积并难线段树中的域要多考虑几个部分需要掌握维护线段树存储线段的段数与长度和经典中的经典题目难度系数****/JudgeOnline/problem?id=1389Area of Simple Polygons直接拿1151的代码AC 没什么好说的难度系数***/JudgeOnline/problem?id=1823Hotelpoj 3667的姊妹篇不要看AC率不高但是比3667容易些吧线段树线段的插入删除求线段树中最长的线段长度不错的题目难度系数***/JudgeOnline/problem?id=2104K-th Number线段树维护归并排序树+三次二分查找别以为这题AC率高就容易多数人没用这算法而是水过去的为了练习线段树还是好好做吧...~ 三次二分挺容易出错的难度系数*****/JudgeOnline/problem?id=2155Matrix楼教出的二维线段树..也可以用二维树状数组题目容易理解没有陷阱难度系数**/JudgeOnline/problem?id=2299Ultra-QuickSort线段树求逆序数最基础的线段树计数问题没什么好说的..难度系数*/JudgeOnline/problem?id=2352Stars也是线段树计数问题求比当前插入的数小的数的个数简单题难度系数*/JudgeOnline/problem?id=2482Stars in Your Window扫描线+离散化+线段树刘汝佳黑书中介绍过算法不过我觉得不是很好看懂题目规定的矩形框高度为h。

POJ1007解题报告

POJ1007解题报告

POJ1007题名描述:DescriptionOne measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequence ``DAABEC'', this measure is 5, since D is greater than four letters to its right and E is greater than one letter to its right. This measure is called the number of inversions in the sequence. The sequence ``AACEDGG'' has only one inversion (E and D)---it is nearly sorted---while the sequence ``ZWQM'' has 6 inversions (it is as unsorted as can be---exactly the reverse of sorted).You are responsible for cataloguing a sequence of DNA strings (sequences containing only the four letters A, C, G, and T). However, you want to catalog them, not in alphabetical order, but rather in order of ``sortedness'', from ``most sorted'' to ``least sorted''. All the strings are of the same length.InputThe first line contains two integers: a positive integer n (0 < n <= 50) giving the length of the strings; and a positive integer m (0 < m <= 100) giving the number of strings. These are followed by m lines, each containing a string of length n.OutputOutput the list of input strings, arranged from ``most sorted'' to ``least sorted''. Since two strings can be equally sorted, then output them according to the orginal order.Sample Input10 6AACATGAAGGTTTTGGCCAATTTGGCCAAAGATCAGATTTCCCGGGGGGAATCGATGCATSample OutputCCCGGGGGGAAACATGAAGGGATCAGATTTATCGATGCATTTTTGGCCAATTTGGCCAAA这道题的题意是输入N个字符串,按照字符串的逆序数由最少到最大开始输出。

POJ图论分类

POJ图论分类

1062* 昂贵的聘礼枚举等级限制+dijkstra Accepted 1087* A Plug for UNIX 2分匹配1094 Sorting It All Out floyd 或拓扑Accepted1112* Team Them Up! 2分图染色+DP1125 Stockbroker Grapevine FLOYD Accepted1135 Domino Effect 最短路Accepted1149* PIGS 网络流Accepted1161* Walls floyd Accepted1201 Intervals 差分约束Accepted1236* Network of Schools 强联通Accepted1251 Jungle Roads MST1273 Drainage Ditches 最大流Accepted1274 The Perfect Stall 2分匹配Accepted1275* Cashier Employment 差分约束1325 Machine Schedule 2分匹配(最小点覆盖)1364 King 差分约束Accepted1422 Air Raid 2分匹配Accepted1459 Power Network 网络流1466 Girls and Boys 2分图(最大独立团)1469 COURSES 2分匹配Accepted1502 MPI Maelstrom floyd1511* Invitation Cards 最短路Accepted1637* Sightseeing tour 混合图欧拉回路-网络流Accepted 1716 Integer Intervals 差分约束1724* ROADS dfs accepted1780* Code 欧拉回路1789 Truck History 最小生成树1797 Heavy Transportation 最小生成树1847 Tram 最短路1904* King's Quest 强联通1949 Chores 最短路2060 Taxi Cab Scheme 2分匹配2075 Tangled in Cables 最小生成树2112 Optimal Milking 网络流2125 Destroying The Graph 最小割2135 Farm Tour 费用流Accepted2139 Six Degrees of Cowvin Bacon floyd2226 Muddy Fields 2分匹配2230 Watchcow 欧拉回路Accepted2239 Selecting Courses 2分匹配2267* From Dusk till Dawn or: Vladimir the Vampire 最短路2289 Jamie's Contact Groups 网络流2337 Catenyms 欧拉通路2349 Arctic Network 最小生成树2367 Genealogical tree 拓扑序2387 Til the Cows Come Home 最短路2391* Ombrophobic Bovines 最大流2394 Checking an Alibi 最短路2396* Budget 网络流2421* Constructing Roads 最小生成树2446 Chessboard 2分匹配Accepted2455 Secret Milking Machine 网络流Accepted2457 Part Acquisition 最短路2472 106 miles to Chicago 最短路2485 Highways 最小生成树Accepted2516 Minimum Cost 费用流2536 Gopher II 2分匹配2553* The Bottom of a Graph 强联通2570 Fiber Network floyd2584 T-Shirt Gumbo 网络流2594* Treasure Exploration 2分匹配2723 Get Luffy Out 2-sat2724 Purifying Machine 2分匹配2728 Desert King 最优比例生成树2749* Building roads 2-sat2762 Going from u to v or from v to u? 强联通Accepted 2949* Word Rings 差分约束2983 Is the Information Reliable? 差分约束2987 Firing 最小割(求解正确性??)3020 Antenna Placement 2分匹配3041 Asteroids 2分匹配3072* Robot 最短路3160 Father Christmas flymouse 强联通3164 Command Network 最小树形图3169 Layout 差分约束3177 Redundant Paths 双联通分量Accepted3189 Steady Cow Assignment 网络流3204 Ikki's Story I - Road Reconstruction 最大流3207 Ikki's Story IV - Panda's Trick 2分图3216 Repairing Company 2分匹配3228 Gold Transportation 网络流3255 Roadblocks 最短路3259 Wormholes 最短路Accepted3268 Silver Cow Party 最短路3275 Ranking the Cows dfs Accepted3281 Dining 最大流Accepted3308 Paratroopers 最小割3310 Caterpillar3311 Hie with the Pie floyd Accepted3328 Cliff Climbing 最短路3343 Against Mammoths 2分匹配3352 Road Construction 桥Accepted3439 Server Relocation 最短路3463 Sightseeing 最短路Accepted3469 Dual Core CPU 最小割Accepted3487 The Stable Marriage Problem 稳定婚姻3522 Slim Span 最小生成树Accepted3594 Escort of Dr. Who How 最短路3615 Cow Hurdles 最短路Accepted3623 Wedding 2-sat3653 Here We Go(relians) Again 最短路3659* Cell Phone Network 最小支配集3660 Cow Contest 拓扑3662* Telephone Lines 最短路3678 Katu Puzzle 2-sat3683* Priest John's Busiest Day 2-sat求解3687 Labeling Balls 差分约束或拓扑3692 Kindergarten 2分匹配3694 Network 无向图缩点3723 *Conscription 最小生成树Accepted。

poj ACM题

poj ACM题

求高精度幂Time Limit: 500MS Memory Limit: 10000KTotal Submissions: 77451 Accepted: 18371 Description对数值很大、精度很高的数进行高精度计算是一类十分常见的问题。

比如,对国债进行计算就是属于这类问题。

现在要你解决的问题是:对一个实数R( 0.0 < R < 99.999 ),要求写程序精确计算R 的n 次方(R n),其中n 是整数并且0 < n <= 25。

InputT输入包括多组R 和n。

R 的值占第1 到第6 列,n 的值占第8 和第9 列。

Output对于每组输入,要求输出一行,该行包含精确的R 的n 次方。

输出需要去掉前导的0 后不要的0 。

如果输出是整数,不要输出小数点。

Sample Input95.123 120.4321 205.1234 156.7592 998.999 101.0100 12Sample Output548815620517731830194541.89902534341571597353596722186985 2721.00000005148554641076956121994511276767154838481760200726 35120383542976301346240143992025569.928573701266488041146654993318703707511666295 47672049395302429448126.76412102161816443020690903717327667290429072743629540498.1075960194566517745610440100011.126825030131969720661201487-3279Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 145788 Accepted: 24911 Description企业喜欢用容易被记住的电话号码。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

初期:一.基本算法:(1)枚举. (poj1753,poj2965)(2)贪心(poj1328,poj2109,poj2586)(3)递归和分治法.(4)递推.(5)构造法.(poj3295)(6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法:(1)图的深度优先遍历和广度优先遍历.(2)最短路径算法(dijkstra,bellman-ford,floyd,heap+dijkstra)(poj1860,poj3259,poj1062,poj2253,poj1125,poj2240)(3)最小生成树算法(prim,kruskal) (poj1789,poj2485,poj1258,poj3026)(4)拓扑排序 (poj1094)(5)二分图的最大匹配 (匈牙利算法) (poj3041,poj3020)(6)最大流的增广路算法(KM算法). (poj1459,poj3436)三.数据结构.(1)串 (poj1035,poj3080,poj1936)(2)排序(快排、归并排(与逆序数有关)、堆排) (poj2388,poj2299)(3)简单并查集的应用.(4)哈希表和二分查找等高效查找法(数的Hash,串的Hash)(poj3349,poj3274,POJ2151,poj1840,poj2002,poj2503)(5)哈夫曼树(poj3253)(6)堆(7)trie树(静态建树、动态建树) (poj2513)四.简单搜索(1)深度优先搜索 (poj2488,poj3083,poj3009,poj1321,poj2251)(2)广度优先搜索(poj3278,poj1426,poj3126,poj3087.poj3414)(3)简单搜索技巧和剪枝(poj2531,poj1416,poj2676,1129)五.动态规划(1)背包问题. (poj1837,poj1276)(2)型如下表的简单DP(可参考lrj的书 page149):1.E[j]=opt{D+w(i,j)} (poj3267,poj1836,poj1260,poj2533)2.E[i,j]=opt{D[i-1,j]+xi,D[i,j-1]+yj,D[i-1][j-1]+zij} (最长公共子序列) (poj3176,poj1080,poj1159)3.C[i,j]=w[i,j]+opt{C[i,k-1]+C[k,j]}.(最优二分检索树问题)六.数学(1)组合数学:1.加法原理和乘法原理.2.排列组合.3.递推关系.(POJ3252,poj1850,poj1019,poj1942)(2)数论.1.素数与整除问题2.进制位.3.同余模运算.(poj2635, poj3292,poj1845,poj2115)(3)计算方法.1.二分法求解单调函数相关知识.(poj3273,poj3258,poj1905,poj3122)七.计算几何学.(1)几何公式.(2)叉积和点积的运用(如线段相交的判定,点到线段的距离等). (poj2031,poj1039)(3)多边型的简单算法(求面积)和相关判定(点在多边型内,多边型是否相交)(poj1408,poj1584)(4)凸包. (poj2187,poj1113)中级:一.基本算法:(1)C++的标准模版库的应用. (poj3096,poj3007)(2)较为复杂的模拟题的训练(poj3393,poj1472,poj3371,poj1027,poj2706)二.图算法:(1)差分约束系统的建立和求解. (poj1201,poj2983)(2)最小费用最大流(poj2516,poj2516,poj2195)(3)双连通分量(poj2942)(4)强连通分支及其缩点.(poj2186)(5)图的割边和割点(poj3352)(6)最小割模型、网络流规约(poj3308, )三.数据结构.(1)线段树. (poj2528,poj2828,poj2777,poj2886,poj2750)(2)静态二叉检索树. (poj2482,poj2352)(3)树状树组(poj1195,poj3321)(4)RMQ. (poj3264,poj3368)(5)并查集的高级应用. (poj1703,2492)(6)KMP算法. (poj1961,poj2406)四.搜索(1)最优化剪枝和可行性剪枝(2)搜索的技巧和优化 (poj3411,poj1724)(3)记忆化搜索(poj3373,poj1691)五.动态规划(1)较为复杂的动态规划(如动态规划解特别的施行商问题等) (poj1191,poj1054,poj3280,poj2029,poj2948,poj1925,poj3034)(2)记录状态的动态规划. (POJ3254,poj2411,poj1185)(3)树型动态规划(poj2057,poj1947,poj2486,poj3140)六.数学(1)组合数学:1.容斥原理.2.抽屉原理.3.置换群与Polya定理(poj1286,poj2409,poj3270,poj1026).4.递推关系和母函数.(2)数学.1.高斯消元法(poj2947,poj1487, poj2065,poj1166,poj1222)2.概率问题. (poj3071,poj3440)3.GCD、扩展的欧几里德(中国剩余定理) (poj3101)(3)计算方法.1.0/1分数规划. (poj2976)2.三分法求解单峰(单谷)的极值.3.矩阵法(poj3150,poj3422,poj3070)4.迭代逼近(poj3301)(4)随机化算法(poj3318,poj2454)(5)杂题. (poj1870,poj3296,poj3286,poj1095)七.计算几何学.(1)坐标离散化.(2)扫描线算法(例如求矩形的面积和周长并,常和线段树或堆一起使用).(poj1765,poj1177,poj1151,poj3277,poj2280,poj3004)(3)多边形的内核(半平面交)(poj3130,poj3335)(4)几何工具的综合应用.(poj1819,poj1066,poj2043,poj3227,poj2165,poj3429)高级:一.基本算法要求:(1)代码快速写成,精简但不失风格(poj2525,poj1684,poj1421,poj1048,poj2050,poj3306)(2)保证正确性和高效性. poj3434二.图算法:(1)度限制最小生成树和第K最短路. (poj1639)(2)最短路,最小生成树,二分图,最大流问题的相关理论(主要是模型建立和求解) (poj3155, poj2112,poj1966,poj3281,poj1087,poj2289,poj3216,poj2446) (3)最优比率生成树. (poj2728)(4)最小树形图(poj3164)(5)次小生成树.(6)无向图、有向图的最小环三.数据结构.(1)trie图的建立和应用. (poj2778)(2)LCA和RMQ问题(LCA(最近公共祖先问题) 有离线算法(并查集+dfs) 和在线算法(RMQ+dfs)).(poj1330)(3)双端队列和它的应用(维护一个单调的队列,常常在动态规划中起到优化状态转移的目的).(poj2823)(4)左偏树(可合并堆).(5)后缀树(非常有用的数据结构,也是赛区考题的热点). (poj3415,poj3294)四.搜索(1)较麻烦的搜索题目训练(poj1069,poj3322,poj1475,poj1924,poj2049,poj3426)(2)广搜的状态优化:利用M进制数存储状态、转化为串用hash表判重、按位压缩存储状态、双向广搜、A*算法. (poj1768,poj1184,poj1872,poj1324,poj2046,poj1482)(3)深搜的优化:尽量用位运算、一定要加剪枝、函数参数尽可能少、层数不易过大、可以考虑双向搜索或者是轮换搜索、IDA*算法.(poj3131,poj2870,poj2286)五.动态规划(1)需要用数据结构优化的动态规划. (poj2754,poj3378,poj3017)(2)四边形不等式理论.(3)较难的状态DP(poj3133)六.数学(1)组合数学.1.MoBius反演(poj2888,poj2154)2.偏序关系理论.(2)博奕论.1.极大极小过程(poj3317,poj1085)2.Nim问题.七.计算几何学.(1)半平面求交(poj3384,poj2540)(2)可视图的建立(poj2966)(3)点集最小圆覆盖.(4)对踵点(poj2079)八.综合题.(poj3109,poj1478,poj1462,poj2729,poj2048,poj3336,poj3315,poj2148,poj1263) 以及补充Dp状态设计与方程总结1.不完全状态记录<1>青蛙过河问题<2>利用区间dp2.背包类问题<1> 0-1背包,经典问题<2>无限背包,经典问题<3>判定性背包问题<4>带附属关系的背包问题<5> + -1背包问题<6>双背包求最优值<7>构造三角形问题<8>带上下界限制的背包问题(012背包)3.线性的动态规划问题<1>积木游戏问题<2>决斗(判定性问题)<3>圆的最大多边形问题<4>统计单词个数问题<5>棋盘分割<6>日程安排问题<7>最小逼近问题(求出两数之比最接近某数/两数之和等于某数等等)<8>方块消除游戏(某区间可以连续消去求最大效益)<9>资源分配问题<10>数字三角形问题<11>漂亮的打印<12>邮局问题与构造答案<13>最高积木问题<14>两段连续和最大<15>2次幂和问题<16>N个数的最大M段子段和<17>交叉最大数问题4.判定性问题的dp(如判定整除、判定可达性等)<1>模K问题的dp<2>特殊的模K问题,求最大(最小)模K的数<3>变换数问题5.单调性优化的动态规划<1>1-SUM问题<2>2-SUM问题<3>序列划分问题(单调队列优化)6.剖分问题(多边形剖分/石子合并/圆的剖分/乘积最大)<1>凸多边形的三角剖分问题<2>乘积最大问题<3>多边形游戏(多边形边上是操作符,顶点有权值)<4>石子合并(N^3/N^2/NLogN各种优化)7.贪心的动态规划<1>最优装载问题<2>部分背包问题<3>乘船问题<4>贪心策略<5>双机调度问题Johnson算法8.状态dp<1>牛仔射击问题(博弈类)<2>哈密顿路径的状态dp<3>两支点天平平衡问题<4>一个有向图的最接近二部图9.树型dp<1>完美服务器问题(每个节点有3种状态)<2>小胖守皇宫问题<3>网络收费问题<4>树中漫游问题<5>树上的博弈<6>树的最大独立集问题<7>树的最大平衡值问题<8>构造树的最小环转一个搞ACM需要的掌握的算法.要注意,ACM的竞赛性强,因此自己应该和自己的实际应用联系起来.适合自己的才是好的,有的人不适合搞算法,喜欢系统架构,因此不要看到别人什么就眼红, 发挥自己的长处,这才是重要的.第一阶段:练经典常用算法,下面的每个算法给我打上十到二十遍,同时自己精简代码,因为太常用,所以要练到写时不用想,10-15分钟内打完,甚至关掉显示器都可以把程序打出来.1.最短路(Floyd、Dijstra,BellmanFord)2.最小生成树(先写个prim,kruscal要用并查集,不好写)3.大数(高精度)加减乘除4.二分查找. (代码可在五行以内)5.叉乘、判线段相交、然后写个凸包.6.BFS、DFS,同时熟练hash表(要熟,要灵活,代码要简)7.数学上的有:辗转相除(两行内),线段交点、多角形面积公式.8. 调用系统的qsort, 技巧很多,慢慢掌握.9. 任意进制间的转换第二阶段:练习复杂一点,但也较常用的算法。

相关文档
最新文档