ACM计算几何题目总结及分类

合集下载

acm数学竞赛试题

acm数学竞赛试题

acm数学竞赛试题
ACM数学竞赛试题通常涉及各种数学领域,包括但不限于代数、几何、概率统计和组合数学等。

以下是一些经典的ACM数学竞赛试题:
1. 平面上n个点的k距离和最小值问题:给定平面上n个点,对于每个点,计算它到其他所有点的距离,然后求出这些距离中的k个最小值。

问题是:如何有效地计算这k个最小值?
2.最长公共子序列问题:给定两个序列,找出它们的最长公共子序列。

例如,对于序列
A = [1, 2, 3, 4] 和
B = [2, 3, 4, 5],最长公共子序列是[2, 3, 4]。

3. 凸包问题:给定平面上的一组点,找到一个最小的凸多边形,使得这个多边形能够包含这组点中的所有点。

4. 最短路问题:给定一个有向图,其中每条边都有一个非负的权重,找出图中任意两点之间的最短路径。

5. 子集和问题:给定一个正整数数组和一个目标值,判断数组中是否存在和为目标值的两个非空子集。

例如,给定数组[1, 2, 3, 4] 和目标值7,判断是否存在两个子集,它们的和分别为7。

以上只是ACM数学竞赛试题的一部分,实际上还有更多涉及数学各个领域的题目。

要提高解决这类问题的能力,需要不断练习和研究。

ACM题目分类总结及pku题目分类

ACM题目分类总结及pku题目分类

ACM题目分类总结及pku题目分类第一篇:ACM题目分类总结及pku题目分类ACM题目分类总结及pku题目分类ACM-题型分类的代码主流算法:1.搜索 //回溯 2. DP(动态规划)3.贪心4.图论 //Dijkstra、最小生成树、网络流 5.数论 //解模线性方程6.计算几何 //凸壳、同等安置矩形的并的面积与周长 7.组合数学 //Polya定理 8.模拟9.数据结构 //并查集、堆 10.博弈论1、排序, 1723, 1727, 1763, 1788, 1828, 1838, 1840, 2201, 2376, 2377, 2380, 1318, 1877, 1928, 1971, 1974, 1990, 2001, 2002, 2092, 2379,1002(需要字符处理,排序用快排即可)1007(稳定的排序)2159(题意较难懂)2231 2371(简单排序)2388(顺序统计算法)2418(二叉排序树)2、搜索、回溯、遍历1022 1111 1118 1129 1190 1562 1564 1573 1655 2184 2225 2243 2312 2362 2378 2386 1010 1011 1018 1020 1054 1062 1256 1321 1363 1501 1650 1659 1664 1753 2078 2083 2303 2310 2329 简单:1128, 1166, 1176, 1231, 1256, 1270, 1321, 1543, 1606, 1664, 1731, 1742, 1745, 1847, 1915, 1950, 2038, 2157, 2182, 2183, 2381, 2386, 2426不易:1024, 1054, 1117, 1167, 1708, 1746, 1775, 1878, 1903, 1966, 2046, 2197,2349 推荐:1011, 1190, 1191, 1416, 1579, 1632, 1639, 1659, 1680, 1683, 1691, 1709, 1714, 1753, 1771, 1826, 1855, 1856, 1890, 1924, 1935, 1948, 1979, 1980, 2170, 2288, 2331, 2339, 2340,1979(和迷宫类似)1980(对剪枝要求较高)3、历法1008 2080(这种题要小心)4、枚举1387,2363,2381,1054(剪枝要求较高),1650(小数的精度问题)5、数据结构的典型算法容易:1182, 1656, 2021, 2023, 2051, 2153, 2227, 2236, 2247, 2352, 2395, 不易:1145, 1177, 1195, 1227, 1661, 1834,推荐:1330, 1338, 1451, 1470, 1634, 1689, 1693, 1703, 1724, 1988, 2004, 2010, 2119, 2274, 1125(弗洛伊德算法),2421(图的最小生成树)6、动态规划1037 A decorative fence 1050 To the Max 1088 滑雪Stockbroker Grapevine 1141 Brackets Sequence 1159 Palindrome 1160 Post Office 1163 The Triangle 1458 Common Subsequence 1579 Function Run Fun 1887 Testing the CATCHER 1953 World Cup Noise 2386 Lake Counting7、贪心 , , 1230, 1323, 1477, 1716, 1784,1328 1755(或用单纯形方法),2054,1017,1328,1862, 1922, 2054,2209,2313,2325,23708、模拟容易:1006, 1008, 1013, 1016, 1017, 1169, 1298, 1326, 1350, 1363, 1676, 1786, 1791, 1835, 1970, 2317, 2325, 2390,不易:1012, 1082, 1099, 1114, 1642, 1677, 1684, 1886,1281 1928 2083 2141 20159、递归 166410、字符串处理1488, 1598, 1686, 1706, 1747, 1748, 1750, 1760, 1782, 1790, 1866, 1888, 1896, 1951, 2003, 2121, 2141, 2145, 2159, 2337, 2359, 2372, 2406, 2408, 1016 1051 1126 1318 1572 1917 1936 2039 2083 2136 2271 2317 2330,2121 240311、数论1014, 1023, 1061, 1152, 1183, 1730, 226212、几何有关的题目凸包:1113, 1228, 1794, 2007, 2187,1113 wall,2187 beauty contest 容易:1319, 1654, 1673, 1675, 1836, 2074, 2137, 2318, 不易:1685, 1687, 1696, 1873, 1901, 2172, 2333,13、任意精度运算、数字游戏、高精度计算1001 1023 1047 1060 1079 1131 1140 1142 1207 1220 1284 1289 1306 1316 1338 1405 1454 1503 1504 1519 1565 1650 1969 2000 2006 2081 2247 2262 2305 2316 2389 1001, 1220, 1405, 1503,1001(高精度乘法)2413(高精度加法,还有二分查找)14、概率统计 1037,105015、小费用最大流、最大流2195 going home2400 supervisor, supervisee 1087 a plug for UNIX 1149 PIGS 1273 drainage ditches 1274 the perfect stall 1325 machine schedule 1459 power network 2239 selecting courses16、压缩存储的DP1038 bugs integrated inc,1185 炮兵阵地,2430 lazy cow17、最长公共子串(LCS)1080 human gene functions,1159 palindrome,1458 common subsequence,2192 zipper18、图论及组合数学2421 Constructing Roads 2369 Permutations 2234 Matches Game 2243 Knight Moves 2249 Binomial Showdown 2255 Tree Recovery 2084 Game of Connections 1906 Three powers 1833 排列 1850 Code1562 Oil Deposits 1496 Word Index 1306 Combinations1125 Stockbroker Grapevine 1129 Channel Allocation 1146 ID Codes1095 Trees Made to Order找规律2247 Humble Numbers2309 BST2346 Lucky tickets 2370 Democracy in danger 2365 Rope2101 Honey and Milk Land 2028 When Can We Meet? 2084 Game of Connections 1915 Knight Moves 1922 Ride to School 1941 The Sierpinski Fractal 1953 World Cup Noise1958 Strange Towers of Hanoi 1969 Count on Canton 1806 Manhattan 2025 1809 Regetni 1844 Sum1870 Bee Breeding 1702 Eva‘s Balance 1728 A flea on a chessboard 1604 Just the Facts 1642 Stacking Cubes 1656 Counting Black1657 Distance on Chessboard 1662 CoIns 1663 Number Steps 1313 Booklet Printing 1316 Self Numbers 1320 Street Numbers 1323 Game Prediction 1338 Ugly Numbers 1244 Slots of Fun 1250 Tanning Salon 1102 LC-Display 1147 Binary codes 1013 Counterfeit Dollar19、博弈类1067 取石子游戏1740 A New Stone Game 2234 Matches Game 1082 Calendar Game 2348 Euclid‘s Game 2413 How many Fibs? 2419 Forest20、简单、模拟题1001 Exponentiation 1002 487-3279 1003 Hangover1701 Dissatisfying Lift 2301 Beat the Spread!2304 Combination Lock 2328 Guessing Game 2403 Hay Points 2406 Power Strings2339 Rock, Scissors, Paper 2350 Above Average2218 Does This Make Me Look Fat? 2260 Error Correction 2262 Goldbach‘s Conjecture 2272 Bullseye2136 Vertical Histogram 2174 Decoding Task 2183 Bovine Math Geniuses 2000 Gold Coins 2014 Flow Layout 2051 Argus 2081 Calendar 1918 Ranking List 1922 Ride to School 1970 The Game 1972 Dice Stacking 1974 The Happy Worm 1978 HanafudaShuffle 1979 Red and Black 1617 Crypto Columns 1666 Candy Sharing Game 1674 Sorting by Swapping 1503 Integer Inquiry 1504 Adding Reversed Numbers 1528 Perfection1546 Basically Speaking 1547 Clay Bully 1573 Robot Motion 1575 Easier Done Than Said? 1581 A Contesting Decision 1590 Palindromes1454 Factorial Frequencies 1363 Rails1218 THE DRUNK JAILER 1281 MANAGER 1132 Border1028 Web Navigation21、初等数学1003 Hangover 1045 Bode Plot1254 Hansel and Grethel 1269 Intersecting Lines 1401 Factorial 1410 Intersection 2363 Blocks 2365 Rope2242 The Circumference of the Circle 2291 Rotten Ropes 2295 A DP Problem2126 Factoring a Polynomial 2191 Mersenne Composite Numbers 2196 Specialized Four-Digit Numbers 1914 Cramer‘s Rule 1835 宇航员 1799 Yeehaa!1607 Deck1244 Slots of Fun 1269 Intersecting Lines 1299 Polar Explorer 1183 反正切函数的应用22、匹配1274, 1422, 1469, 1719, 2060, 2239,23、经典1011(搜索好题)1012(学会打表)10131019(它体现了很多此类问题的特点)1050(绝对经典的dp)1088(dp好题)1157(花店,经典的dp)1163(怎么经典的dp那么多呀)1328(贪心)1458(最长公共子序列)1647(很好的真题,考临场分析准确和下手迅速)1654(学会多边形面积的三角形求法)1655(一类无根树的dp问题)1804(逆序对)2084(经典组合数学问题)2187(用凸包求最远点对,求出凸包后应该有O(N)的求法,可我就是调不出来)2195(二分图的最佳匹配)2242(计算几何经典)2295(等式处理)2353(dp,但要记录最佳路径)2354(立体解析几何)2362(搜索好题)2410(读懂题是关键)2411(经典dp)24、趣味1067(很难的数学,但仔细研究,是一片广阔的领域)1147(有O(n)的算法,需要思考)1240(直到一棵树的先序和后序遍历,那么有几种中序遍历呢?dp)1426(是数论吗?错,是图论!)1648(别用计算几何,用整点这个特点绕过精度的障碍吧)1833(找规律)1844(貌似dp或是搜索,其实是道有趣的数学题)1922(贪心,哈哈)22312305(不需要高精度噢)2328(要仔细噢)2356(数论知识)2359(约瑟夫问题变种)2392(有趣的问题)25、很繁的题1001 10081087(构图很烦,还有二分图的最大匹配)1128(USACO)1245 13291550(考的是读题和理解能力)1649(dp)2200(字符串处理+枚举)2358(枚举和避免重复都很烦)2361(仔细仔细再仔细)26、难题1014(数学证明较难,但有那种想法更重要)1037(比较难的dp)1405(高精度算法也有等级,不断改进吧)2002(有没有比O(n^2*logn)更有的算法?)2054(极难,很强的思考能力)2085(组合数学)2414(dp,但要剪枝)2415(搜索)2423(计算几何+统计)27、多解题1002(可以用排序,也可以用统计的方法)1338(搜索和dp都可以)1664(搜索和dp都练一练吧)2082(这可是我讲的题噢)2352(桶排和二叉树都行)28、Note:1011: 很经典的剪支 1014: 难在数学上1017: 严格的数学证明貌似不容易1021: 有点繁,考察对图形进行各种旋转 1083: 巧妙的思考角度 1150: 分奇偶讨论,lg(n)算法1218: 三行就够,虽然简单,但也有优劣之别 1505: 二分加贪心1654: 做法也许很多,本人用有向面积做的 1674: 计算圈的个数(算是graph 吧)1700: 数学证明不容易 1742: O(m*n)的算法 1863: 要耐心地慢慢写…^_^ 1988: 并查集 2051: 堆2078: 不难,但剪支可以做到很好2082::O(n),你想到了吗?2084: 卡特兰数 2182: 线段树2195: 最小费用最大流 2234: 经典博弈算法 2236: 并查集 2299: 二分思想2395: Kruskal 最小生成树的拓展 2406: KMP2411: 用二进制串来表示状态第二篇:垃圾分类题目判断1.打印,墨盒属于有害垃圾(×,是可回收垃圾)2.PC塑料瓶可以制成衣服(×是PET塑料瓶)3.废胶卷及废相纸属于其他垃圾(错,应是有害垃圾)4.污染纸张属于其他垃圾(对)5.世界上最早对包装垃圾分类回收进行立法的是德国(对)6.餐厨废弃物资源化利用和无公害化处理试点城市启动至今,目前已有83个城市成为试点(错,应是100个)7.口红是干垃圾(对)8.烟头是有害垃圾(错)9.家里枯萎的水培植物和鲜花属于其他垃圾(错)10.消毒剂及其包装物属于可回收垃圾(错)单选11.城市垃圾分类处理的基本原则是(BC)A.合理利用,变废为宝B.全民动员,科学引导C.政府主导,社会参与D.统筹规划,综合布局12.可以燃烧的生活垃圾包括(AB)A.废旧木头B.废塑料橡胶C.不易回收的废纸D.玻璃13.没有泡过的干茶叶属于哪类垃圾(AC)A.厨余垃圾B.干垃圾C.湿垃圾D.可回收垃圾E.有害垃圾14.以下哪些不与生活垃圾混合投放(ABD)A.沙发B.油漆桶C.宠物饲料D.砖石混凝土15.危险性包装是指盛装具有对人体,动植物和生态环境有危害特性物资的包装物,包括下列哪些特性描述(BCD)A.易爆性B.易燃性C.腐蚀性D.感染性16.生活垃圾分类办法是根据什么来制定的(ABD)A.处理方式B.管理水平C.居民生活习惯D.垃圾特性17.有害生活垃圾单独收运和处理工作已引起社会高度重视,下列废弃物中哪个不是生活中的有害垃圾(AC)A.烟头B.温度计C.碱性电池D.过期药品E.含汞荧光灯18.垃圾分类的意义,在于实现了生活垃圾(BE)减量化,资源化,无害化A.减量化,整合化B.资源化,无害化C.减量化,分类化D.资源化,整合化E.无害化,减量化19.下列关于垃圾分类的语句正确的是(AD)A.红危危,绿厨厨,蓝宝宝,黄其其B.绿色回收又能卖,红色有毒又有害C.蓝色剩菜瓜果皮,黄灰桶里放其他D.湿纸巾再湿也是干垃圾20.白色垃圾的危害(ACD)A.不易降解,混在土壤里影响农作物吸收养分和水分,导致农作物减产B.混在生活垃圾中不会增加后续处理难度C.影响市容及景观D.焚烧过程中产生大量有毒气体多选21.生物垃圾通常指随着时间的推移可以得到化学分解有机物垃圾以及动物尸体,通常占总量的多少(B)A.30%B.40%C.50%D.60%22.回收1.5吨的废纸可以造好纸约(B)公斤(425+850=1275)A.1255B1275C.1295D.130023.一氧化碳可与人血红蛋白结合致人中毒死亡,排放一氧化碳量较多的汽车状态是(A)A.开着发动机停车等候时B.高速行驶C.超速行驶D.缓慢行驶24.那种垃圾可以重新提炼出有用的材料(B)A.厨余垃圾B.有害垃圾C.可回收垃圾D.其他垃圾25.下列不属于其他垃圾的是(C)A.灰土烟头B.废弃纸巾C.果皮D.宠物粪便26.羊毛衫,靠垫,牙签,筷子,旧手机分别属于什么垃圾(C)A.可回收垃圾,干垃圾,干垃圾,可回收垃圾,有害垃圾B.干垃圾,可回收垃圾,干垃圾,可回收垃圾,有害垃圾C.可回收垃圾,可回收垃圾,干垃圾,干垃圾,可回收垃圾D.干垃圾,干垃圾,可回收垃圾,可回收垃圾,有害垃圾27.薄型塑料袋,吃剩的罐头食品,用完的笔芯,受潮过期的瓜子分别属于什么垃圾(B)A.可回收垃圾,湿垃圾,干垃圾,干垃圾B.干垃圾,湿垃圾,干垃圾,湿垃圾C.可回收垃圾,湿垃圾,可回收垃圾,湿垃圾D.干垃圾,湿垃圾,可回收垃圾,干垃圾28.可回收垃圾是指回收后经过再加工,整理可以成为生产原料或再利用的物品,不包括(D)A.电子废弃品B.纸类C.塑料类D.杀虫剂29.黑色塑料袋,洗发水瓶,葡萄干,没用完的铅笔分别属于哪类垃圾(D)A.可回收垃圾,可回收垃圾,干垃圾,可回收垃圾B.干垃圾,可回收垃圾,干垃圾,干垃圾C.可回收垃圾,干垃圾,湿垃圾,可回收垃圾D.干垃圾,可回收垃圾,湿垃圾,干垃圾30.粉底液,大棒骨,鸡骨头,湿垃圾袋分别是什么垃圾(A)A.干垃圾,干垃圾,湿垃圾,干垃圾B.湿垃圾,干垃圾,湿垃圾,可回收垃圾C.干垃圾,湿垃圾,干垃圾,可回收垃圾D.湿垃圾,干垃圾,湿垃圾,干垃圾31.巧克力,菜刀,洗干净的化妆瓶,睫毛夹分别属于什么垃圾(B)A.干垃圾,有害垃圾,可回收垃圾,干垃圾B.湿垃圾,可回收垃圾,可回收垃圾,可回收垃圾C.湿垃圾,有害垃圾,干垃圾,可回收垃圾D.干垃圾,可回收垃圾,干垃圾,干垃圾32.椰壳,木梳,化妆棉,假花分别属于什么垃圾(D)A.干垃圾,有害垃圾,湿垃圾,可回收垃圾B.可回收垃圾,有害垃圾,干垃圾,干垃圾C.可回收垃圾,干垃圾,湿垃圾,干垃圾D.干垃圾,可回收垃圾,干垃圾,可回收垃圾33.新版《生活垃圾分类标志》标准于12月1日起正式实施,由原来的()大类改为现在的四大类,分别为可回收垃圾,有害垃圾,(),()。

大学ACM考试题目及作业答案整理

大学ACM考试题目及作业答案整理

ACM作业与答案整理1、平面分割方法:设有n条封闭曲线画在平面上,而任何两条封闭曲线恰好相交于两点,且任何三条封闭曲线不相交于同一点,问这些封闭曲线把平面分割成的区域个数。

#include <iostream.h>int f(int n){if(n==1) return 2;else return f(n-1)+2*(n-1);}void main(){int n;while(1){cin>>n;cout<<f(n)<<endl;}}2、LELE的RPG难题:有排成一行的n个方格,用红(Red)、粉(Pink)、绿(Green)三色涂每个格子,每格涂一色,要求任何相邻的方格不能同色,且首尾两格也不同色.编程全部的满足要求的涂法.#include<iostream.h>int f(int n){if(n==1) return 3;else if(n==2) return 6;else return f(n-1)+f(n-2)*2;}void main(){int n;while(1){cin>>n;cout<<f(n)<<endl;}}3、北大ACM(1942)Paths on a GridTime Limit: 1000MS Memory Limit: 30000K DescriptionImagine you are attending your math lesson at school. Once again, you are bored because your teacher tells things that you already mastered years ago (this time he's explaining that (a+b)2=a2+2ab+b2). So you decide to waste your time with drawing modern art instead.Fortunately you have a piece of squared paper and you choose a rectangle of size n*m on the paper. Let's call this rectangle together with the lines it contains a grid. Starting at the lower left corner of the grid, you move your pencil to the upper right corner, taking care that it stays on the lines and moves only to the right or up. The result is shown on the left:Really a masterpiece, isn't it? Repeating the procedure one more time, you arrive with the picture shown on the right. Now you wonder: how many different works of art can you produce?InputThe input contains several testcases. Each is specified by two unsigned 32-bit integers n and m, denoting the size of the rectangle. As you can observe, the number of lines of the corresponding grid is one more in each dimension. Input is terminated by n=m=0.OutputFor each test case output on a line the number of different art works that can be generated using the procedure described above. That is, how many paths are there on a grid where each step of the path consists of moving one unit to the right orone unit up? You may safely assume that this number fits into a 32-bit unsigned integer.Sample Input5 41 10 0Sample Output1262#include<iostream>using namespace std;longlong f(long long m, long long n){if(n==0) return 1;else return f(m-1,n-1)*m/n;}int main(){longlongm,n;while(scanf("%I64d %I64d",&n,&m) &&n+m){printf("%I64d\n",f(m+n,min(m,n)));}return 0;}1、(并查集)若某个家族人员过于庞大,要判断两个是否是亲戚,确实还很不容易,现在给出某个亲戚关系图,求任意给出的两个人是否具有亲戚关系。

acm 计算几何

acm 计算几何

1.扇形的重心Xc = 2*R*sinA/3/A (A为圆心角的一半)2.N点中三个点组成三角形面积最大#include <stdio.h>#include <stdlib.h>#include <math.h>#define MaxNode 50005int stack[MaxNode];int top;double max;typedef struct TPoint{int x;int y;}TPoint;TPoint point[MaxNode];void swap(TPoint point[], int i, int j){TPoint tmp;tmp = point[i];point[i] = point[j];point[j] = tmp;}double multi(TPoint p1, TPoint p2, TPoint p0){return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y); }double distance(TPoint p1, TPoint p2){return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);}int cmp(const void *a, const void *b){TPoint *c = (TPoint *)a;TPoint *d = (TPoint *)b;double k = multi(*c, *d, point[0]);if(k< 0) return 1;else if(k == 0 && distance(*c, point[0]) >= distance(*d, point[0])) return 1;else return -1;}void grahamScan(int n){//Graham扫描求凸包int i, u;//将最左下的点调整到p[0]的位置u = 0;for(i = 1;i <= n - 1;i++){if((point[i].y < point[u].y) ||(point[i].y == point[u].y && point[i].x < point[u].x)) u = i;}swap(point, 0, u);//将平p[1]到p[n - 1]按按极角排序,可采用快速排序qsort(point + 1, n - 1, sizeof(point[0]), cmp);for(i = 0;i <= 2;i++) stack[i] = i;top = 2;for(i = 3;i <= n - 1;i++){while(multi(point[i], point[stack[top]], point[stack[top - 1]]) >= 0){ top--;if(top == 0) break;}top++;stack[top] = i;}}int main(){double triangleArea(int i, int j, int k);void PloygonTriangle();int i, n;while(scanf("%d", &n) && n != -1){for(i = 0;i < n;i++)scanf("%d%d", &point[i].x, &point[i].y);if(n <= 2){printf("0.00\n");continue;}if(n == 3){printf("%.2lf\n", triangleArea(0, 1, 2));continue;}grahamScan(n);PloygonTriangle();printf("%.2lf\n", max);}return 0;}void PloygonTriangle(){double triangleArea(int i, int j, int k);int i, j , k;double area, area1;max = -1;for(i = 0;i <= top - 2;i++){k = -1;for(j = i + 1; j <= top - 1;j++){if(k <= j) k= j + 1;area = triangleArea(stack[i], stack[j], stack[k]);if(area > max) max = area;while(k + 1 <= top){area1= triangleArea(stack[i], stack[j], stack[k + 1]);if(area1 < area) break;if(area1 > max) max = area1;area = area1;k++;}}}}double triangleArea(int i, int j, int k){//已知三角形三个顶点的坐标,求三角形的面积double l = fabs(point[i].x * point[j].y + point[j].x * point[k].y + point[k].x * point[i].y - point[j].x * point[i].y- point[k].x * point[j].y - point[i].x * point[k].y) / 2;return l;}3.N个点最多组成多少个正方形#include<stdio.h>#include<stdlib.h>#include<math.h>#define eps 1e-6#define pi acos(-1.0)#define PRIME 9991struct point{int x, y;}p[2201];int n;struct HASH{int cnt;int next;}hash[50000];int hashl;int Hash(int n){int i = n % PRIME;while(hash[i].next != -1){if(hash[hash[i].next].cnt == n) return 1;else if(hash[hash[i].next].cnt > n) break;i = hash[i].next;}hash[hashl].cnt = n;hash[hashl].next = hash[i].next;hash[i].next = hashl;hashl++;return 0;}int Hash2(int n){int i = n % PRIME;while(hash[i].next != -1){if(hash[hash[i].next].cnt == n) return 1;else if(hash[hash[i].next].cnt > n) return 0;i = hash[i].next;}return 0;}int check(double ax, double ay, int &x, int &y){int a0 = (int)ax;int b0 = (int)ay;int tag1 = 0, tag2 = 0;if(fabs(a0 - ax) < eps){tag1 = 1;x = a0;}else if(fabs(a0 + 1 - ax) < eps){tag1 = 1;x = a0 + 1;}if(fabs(b0 - ay) < eps){tag2 = 1;y = b0;}else if(fabs(b0 + 1 - ay) < eps){y = b0 + 1;tag2 = 1;}if(tag1 == 1 && tag2 == 1) return 1;else return 0;}int squares(point p1, point p2, point &p3, point &p4) {double a = (double)p2.x - p1.x;double b = (double)p2.y - p1.y;double midx = ((double)p1.x + p2.x) / 2;double midy = ((double)p1.y + p2.y) / 2;double tmp = a * a + b * b;double x1 = sqrt(b * b) / 2;double y1;if(fabs(b) < eps) y1 = sqrt(a * a + b * b) / 2;else y1 = -a * x1 / b;x1 += midx;y1 += midy;if(check(x1, y1, p3.x, p3.y) == 0) return 0;x1 = 2 * midx - x1;y1 = 2 * midy - y1;if(check(x1, y1, p4.x, p4.y) == 0) return 0;return 1;}int main(){int i, j, cnt;while(scanf("%d", &n) != EOF && n){for(i = 0;i < PRIME;i++) hash[i].next = -1;hashl = PRIME;int x1, y1, x2, y2;for (i = 0; i < n; i++){scanf("%d%d", &p[i].x, &p[i].y);Hash((p[i].x + 100000) * 100000 + p[i].y + 100000);}cnt = 0;for (i = 0; i < n; i++){for (j = i + 1; j < n; j++){point a, b;if(squares(p[i], p[j], a, b) == 0) continue;if(Hash2((a.x + 100000) * 100000 + a.y + 100000) == 0) continue;if(Hash2((b.x + 100000) * 100000 + b.y + 100000) == 0) continue;cnt++;}}printf("%d\n", cnt / 2);}return 0;}4.单位圆覆盖最多点/*平面上N个点,用一个半径R的圆去覆盖,最多能覆盖多少个点?比较经典的题目。

ACM程序竞赛计算几何超全模板

ACM程序竞赛计算几何超全模板

/*计算几何目录㈠点的基本运算1. 平面上两点之间距离12. 判断两点是否重合13. 矢量叉乘14. 矢量点乘25. 判断点是否在线段上26. 求一点饶某点旋转后的坐标27. 求矢量夹角2㈡线段及直线的基本运算1. 点与线段的关系32. 求点到线段所在直线垂线的垂足43. 点到线段的最近点44. 点到线段所在直线的距离45. 点到折线集的最近距离46. 判断圆是否在多边形内57. 求矢量夹角余弦58. 求线段之间的夹角59. 判断线段是否相交610.判断线段是否相交但不交在端点处611.求线段所在直线的方程612.求直线的斜率713.求直线的倾斜角714.求点关于某直线的对称点715.判断两条直线是否相交及求直线交点716.判断线段是否相交,如果相交返回交点7㈢多边形常用算法模块1. 判断多边形是否简单多边形82. 检查多边形顶点的凸凹性93. 判断多边形是否凸多边形94. 求多边形面积95. 判断多边形顶点的排列方向,方法一106. 判断多边形顶点的排列方向,方法二107. 射线法判断点是否在多边形内108. 判断点是否在凸多边形内119. 寻找点集的graham算法1210.寻找点集凸包的卷包裹法1311.判断线段是否在多边形内1412.求简单多边形的重心1513.求凸多边形的重心1714.求肯定在给定多边形内的一个点1715.求从多边形外一点出发到该多边形的切线1816.判断多边形的核是否存在19㈣圆的基本运算1 .点是否在圆内202 .求不共线的三点所确定的圆21㈤矩形的基本运算1.已知矩形三点坐标,求第4点坐标22㈥常用算法的描述22㈦补充1.两圆关系:242.判断圆是否在矩形内:243.点到平面的距离:254.点是否在直线同侧:255.镜面反射线:256.矩形包含:267.两圆交点:278.两圆公共面积:289. 圆和直线关系:2910. 内切圆:3011. 求切点:3112. 线段的左右旋:3113.公式:32*//* 需要包含的头文件*/#include <cmath >/* 常用的常量定义*/const double INF = 1E200const double EP = 1E-10const int MAXV = 300const double PI = 3.14159265/* 基本几何结构*/struct POINT{double x;double y;POINT(double a=0, double b=0) { x=a; y=b;} //constructor};struct LINESEG{POINT s;POINT e;LINESEG(POINT a, POINT b) { s=a; e=b;}LINESEG() { }};struct LINE // 直线的解析方程a*x+b*y+c=0 为统一表示,约定a >= 0{double a;double b;double c;LINE(double d1=1, double d2=-1, double d3=0) {a=d1; b=d2; c=d3;}};/*********************** ** 点的基本运算** ***********************/double dist(POINT p1,POINT p2) // 返回两点之间欧氏距离{return( sqrt( (p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y) ) );}bool equal_point(POINT p1,POINT p2) // 判断两个点是否重合{return ( (abs(p1.x-p2.x)<EP)&&(abs(p1.y-p2.y)<EP) );}/****************************************************************************** r=multiply(sp,ep,op),得到(sp-op)和(ep-op)的叉积r>0:ep在矢量opsp的逆时针方向;r=0:opspep三点共线;r<0:ep在矢量opsp的顺时针方向******************************************************************************* /double multiply(POINT sp,POINT ep,POINT op){return((sp.x-op.x)*(ep.y-op.y)-(ep.x-op.x)*(sp.y-op.y));}/*r=dotmultiply(p1,p2,op),得到矢量(p1-op)和(p2-op)的点积,如果两个矢量都非零矢量r<0:两矢量夹角为锐角;r=0:两矢量夹角为直角;r>0:两矢量夹角为钝角******************************************************************************* /double dotmultiply(POINT p1,POINT p2,POINT p0){return ((p1.x-p0.x)*(p2.x-p0.x)+(p1.y-p0.y)*(p2.y-p0.y));}/****************************************************************************** 判断点p是否在线段l上条件:(p在线段l所在的直线上) && (点p在以线段l为对角线的矩形内)******************************************************************************* /bool online(LINESEG l,POINT p){return( (multiply(l.e,p,l.s)==0) &&( ( (p.x-l.s.x)*(p.x-l.e.x)<=0 )&&( (p.y-l.s.y)*(p.y-l.e.y)<=0 ) ) ); }// 返回点p以点o为圆心逆时针旋转alpha(单位:弧度)后所在的位置POINT rotate(POINT o,double alpha,POINT p){POINT tp;p.x-=o.x;p.y-=o.y;tp.x=p.x*cos(alpha)-p.y*sin(alpha)+o.x;tp.y=p.y*cos(alpha)+p.x*sin(alpha)+o.y;return tp;}/* 返回顶角在o点,起始边为os,终止边为oe的夹角(单位:弧度)角度小于pi,返回正值角度大于pi,返回负值可以用于求线段之间的夹角原理:r = dotmultiply(s,e,o) / (dist(o,s)*dist(o,e))r'= multiply(s,e,o)r >= 1 angle = 0;r <= -1 angle = -PI-1<r<1 && r'>0 angle = arccos(r)-1<r<1 && r'<=0 angle = -arccos(r)*/double angle(POINT o,POINT s,POINT e){double cosfi,fi,norm;double dsx = s.x - o.x;double dsy = s.y - o.y;double dex = e.x - o.x;double dey = e.y - o.y;cosfi=dsx*dex+dsy*dey;norm=(dsx*dsx+dsy*dsy)*(dex*dex+dey*dey);cosfi /= sqrt( norm );if (cosfi >= 1.0 ) return 0;if (cosfi <= -1.0 ) return -3.1415926;fi=acos(cosfi);if (dsx*dey-dsy*dex>0) return fi; // 说明矢量os 在矢量oe的顺时针方向return -fi;}/*****************************\* ** 线段及直线的基本运算** *\*****************************//* 判断点与线段的关系,用途很广泛本函数是根据下面的公式写的,P是点C到线段AB所在直线的垂足AC dot ABr = ---------||AB||^2(Cx-Ax)(Bx-Ax) + (Cy-Ay)(By-Ay)= -------------------------------L^2r has the following meaning:r=0 P = Ar=1 P = Br<0 P is on the backward extension of ABr>1 P is on the forward extension of AB0<r<1 P is interior to AB*/double relation(POINT p,LINESEG l){LINESEG tl;tl.s=l.s;tl.e=p;return dotmultiply(tl.e,l.e,l.s)/(dist(l.s,l.e)*dist(l.s,l.e));}// 求点C到线段AB所在直线的垂足PPOINT perpendicular(POINT p,LINESEG l){double r=relation(p,l);POINT tp;tp.x=l.s.x+r*(l.e.x-l.s.x);tp.y=l.s.y+r*(l.e.y-l.s.y);return tp;}/* 求点p到线段l的最短距离,并返回线段上距该点最近的点np注意:np是线段l上到点p最近的点,不一定是垂足*/double ptolinesegdist(POINT p,LINESEG l,POINT &np){double r=relation(p,l);if(r<0){np=l.s;return dist(p,l.s);}if(r>1){np=l.e;return dist(p,l.e);}np=perpendicular(p,l);return dist(p,np);}// 求点p到线段l所在直线的距离,请注意本函数与上个函数的区别double ptoldist(POINT p,LINESEG l){return abs(multiply(p,l.e,l.s))/dist(l.s,l.e);}/* 计算点到折线集的最近距离,并返回最近点.注意:调用的是ptolineseg()函数*/double ptopointset(int vcount,POINT pointset[],POINT p,POINT &q) {int i;double cd=double(INF),td;LINESEG l;POINT tq,cq;for(i=0;i<vcount-1;i++)l.s=pointset[i];l.e=pointset[i+1];td=ptolinesegdist(p,l,tq);if(td<cd){cd=td;cq=tq;}}q=cq;return cd;}/* 判断圆是否在多边形内.ptolineseg()函数的应用2 */bool CircleInsidePolygon(int vcount,POINT center,double radius,POINT polygon[]){POINT q;double d;q.x=0;q.y=0;d=ptopointset(vcount,polygon,center,q);if(d<radius||fabs(d-radius)<EP)return true;elsereturn false;}/* 返回两个矢量l1和l2的夹角的余弦(-1 --- 1)注意:如果想从余弦求夹角的话,注意反余弦函数的定义域是从0到pi */double cosine(LINESEG l1,LINESEG l2){return (((l1.e.x-l1.s.x)*(l2.e.x-l2.s.x) +(l1.e.y-l1.s.y)*(l2.e.y-l2.s.y))/(dist(l1.e,l1.s)*dist(l2.e,l2.s))) );}// 返回线段l1与l2之间的夹角单位:弧度范围(-pi,pi)double lsangle(LINESEG l1,LINESEG l2){POINT o,s,e;o.x=o.y=0;s.x=l1.e.x-l1.s.x;s.y=l1.e.y-l1.s.y;e.x=l2.e.x-l2.s.x;e.y=l2.e.y-l2.s.y;return angle(o,s,e);// 如果线段u和v相交(包括相交在端点处)时,返回true////判断P1P2跨立Q1Q2的依据是:( P1 - Q1 ) ×( Q2 - Q1 ) * ( Q2 - Q1 ) ×( P2 - Q1 ) >= 0。

杭电ACM试题详细分类,杭电oj详细分类,hdu详细分类,详细,ACM.doc

杭电ACM试题详细分类,杭电oj详细分类,hdu详细分类,详细,ACM.doc

杭电ACM试题分类枚举1002 10041013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 10391042 10471048 1049 1050 1057 1062 1063 1064 1070 1073 1075 1082 1083 10841088 11061107 1113 1117 1119 1128 1129 1144 1148 1157 1161 1170 1172 117711971200 1201 1202 1205 1209 1212(大数取模)1216 (链表)1218 1219 12251228 12291230 1234 1235 1236 1237 1239 1250 1256 1259 1262 1263 1265 12661276 1279 1282 1283 1287 1296 1302 1303 1304 1305 1306 1309 1311 1314搜索,递归求解1010 1016 1026 1043(双广)1044 (BFS+DFS) 1045 1067 1072 1104 1175 1180 11951208 1226 1238 1240 1241 1242 1258 1271 1312 1317动态规划1003 1024 1025 1028 1051 1058 1059 1069 1074 1078 1080 1081 1085 1087 1114 1158 1159 1160 1171 1176 1181 1203 1224 1227 1231 1244 1248 1253 1254 1283 1300数学,递推,规律1005 1006 1012 1014 1018 1019 1021 1023 1027 1030 1032 1038 1041 1046 1059 1060 1061 1065 1066 1071(微积分)1097 1098 1099 1100 1108 1110 1112 1124 1130 1131 1132 1134 1141 1143 1152 1155(物理题)1163 1165 1178 1194 1196(lowbit) 1210 1214 1200 1221 1223 1249 1261 1267 1273 1290 1291 1292 1294 1297 1313 1316数论1164 1211 1215 1222 1286 1299计算几何1086 1115 1147贪心1009 1052 1055 1257 并查集11981213 1232 1272线段树,离散化11991255图论最短路相关的问题1142 1162 1217 1301二分图问题1054 1068 1150 1151 1281其他1053 (huffman) 1102(MST) 1116 (欧拉回路)1233(MST) 1269 (强连通)数据结构1103 (堆+模拟)1166 (数状树组)1247 1251 1285 (Topol) 1298以下是详细介绍1002简单的大数1003 DP经典问题,最大连续子段和1004简单题1005找规律(循环点)1007经典问题,最近点对问题,用分治1008简单题1010搜索题,剪枝很关1009贪心1012简单题1013简单题(有个小陷阱)1014简单题1015可以看作搜索题吧1016经典的搜索1017简单数学题1018简单数学题1019简单数学题1020简单的字符串处理找规律的数学题数据结构的题(栈的应用)特殊的数(Catalan Number)经典DP,最大M 子段和经典DP,最长递增子序列(要用NLogN的方法过)搜索数学题(或用STL)经典问题,整数拆分,用母函数做简单题(一般方法容易超时)简单题,可用模拟过简单题简单题模拟题Candy Sharing Game模拟题简单题简单题,不是一般的简单简单题字符串处理简单题,排序简单题,用大数大数经典搜索题,八数码问题稍微有点麻烦的搜索题搜索题,可用匹配做简单题简单的大数简单字符串处理简单题贪心经典贪心,也可以用DP贪心贪心,关于Huffman编码二分匹配二分匹配简单题模拟题经典问题,丑数,DP经典问题,可以用母函数或DP (不针对题目优化都会超时)数学题数学题简单字符串处理模拟大数简单题1065简单题1066数学题,找规律1068经典二分匹配1069经典DP1070简单题1071简单数学题1072搜索1073字符串处理1074 DP1075字典树1076简单题1078DP1079博弈(DP)1080DP 1081经典DP1082简单题1083二分匹配1084简单题1085母函数1086简单几何题1087简单DP1088字符串处理1089~1096 (练习输入输出的8个题目)1097简单数学题1098数学题,注意找规律1099数学HrH1500DP1501DP1502DP or记忆化1503DP1504模拟1505DP1506DP15072分匹配1508记忆化容易点1509模拟1510 DP1511搜索可以过1512左偏树1513DP1514DP1515DFS1516DP1517博奕搜索DP (不确定)树状DP 数学题稳定婚姻DP 博弈博弈Maxflow博弈2分匹配简单题最大团差分约束Maxflow入门题KM Or > 小费用流差分约束差分约束博弈模拟加置换群的理论CODE可以短些,其实没必要。

计算几何--ACM

计算几何--ACM

三计算模型
规定RAM的原始运算如下: 1)算术运算 2)两个实数之间的比较 3)间接寻址及求根运算,三角函数运算,指 数函数运算,对数函数运算。 执行每种运算耗费一个时间单位。
四常见计算几何基本问题
• 矢量的概念
• • • • • • • • • • • • • • • • • • • • • • • • • • • •
基本问题(续)
• 在实际编程中,没有必要计算所有的交点,首先应判断线段和多边形的边是否内 交,倘若线段和多边形的某条边内交则线段一定在多边形外;如果线段和多边形 的每一条边都不内交,则线段和多边形的交点一定是线段的端点或者多边形的顶 点,只要判断点是否在线段上就可以了。
得出算法如下: if 线端PQ的端点不都在多边形内 then return false; 点集pointSet初始化为空; for 多边形的每条边s do if 线段的某个端点在s上 then 将该端点加入pointSet; else if s的某个端点在线段PQ上 then 将该端点加入pointSet; else if s和线段PQ相交 // 这时候已经可以肯定是内交了 then return false; 将pointSet中的点按照X-Y坐标排序; for pointSet中每两个相邻点 pointSet[i] , pointSet[ i+1] do if pointSet[i] , pointSet[ i+1] 的中点不在多边形中 then return false; return true; 这个过程中的排序因为交点数目肯定远小于多边形的顶点数目n,所以最多是 常数级的复杂度,几乎可以忽略不计。因此算法的时间复杂度也是O(n)。
基本问题(续)
基本问题(续)

ACM基础题目列表

ACM基础题目列表

题目【题目1】N皇后问题(八皇后问题的扩展)【题目2】排球队员站位问题【题目3】把自然数N分解为若干个自然数之和。

【题目4】把自然数N分解为若干个自然数之积。

【题目5】马的遍历问题。

【题目6】加法分式分解【题目7】地图着色问题【题目8】在n*n的正方形中放置长为2,宽为1的长条块,【题目9】找迷宫的最短路径。

(广度优先搜索算法)【题目10】火车调度问题【题目11】农夫过河【题目12】七段数码管问题。

【题目13】把1-8这8个数放入下图8个格中,要求相邻的格(横,竖,对角线)上填的数不连续.【题目14】在4×4的棋盘上放置8个棋,要求每一行,每一列上只能放置2个.【题目15】迷宫问题.求迷宫的路径.(深度优先搜索法)【题目16】一笔画问题【题目17】城市遍历问题.【题目18】棋子移动问题【题目19】求集合元素问题(1,2x+1,3X+1类)================================================================================================================================================================【题目】N皇后问题(含八皇后问题的扩展,规则同八皇后):在N*N的棋盘上,放置N个皇后,要求每一横行每一列,每一对角线上均只能放置一个皇后,问可能的方案及方案数。

const max=8;var i,j:integer;a:array[1..max] of 0..max; {放皇后数组}b:array[2..2*max] of boolean; {/对角线标志数组}c:array[-(max-1)..max-1] of boolean; {\对角线标志数组}col:array[1..max] of boolean; {列标志数组}total:integer; {统计总数}procedure output; {输出}var i:integer;beginwrite('No.':4,'[',total+1:2,']');for i:=1 to max do write(a[i]:3);write(' ');if (total+1) mod 2 =0 then writeln; inc(total);end;function ok(i,dep:integer):boolean; {判断第dep行第i列可放否}beginok:=false;if ( b[i+dep]=true) and ( c[dep-i]=true) {and (a[dep]=0)} and(col[i]=true) then ok:=trueend;procedure try(dep:integer);var i,j:integer;beginfor i:=1 to max do {每一行均有max种放法}if ok(i,dep) then begina[dep]:=i;b[i+dep]:=false; {/对角线已放标志}c[dep-i]:=false; {\对角线已放标志}col[i]:=false; {列已放标志}if dep=max then outputelse try(dep+1); {递归下一层}a[dep]:=0; {取走皇后,回溯}b[i+dep]:=true; {恢复标志数组}c[dep-i]:=true;col[i]:=true;end;end;beginfor i:=1 to max do begin a[i]:=0;col[i]:=true;end;for i:=2 to 2*max do b[i]:=true;for i:=-(max-1) to max-1 do c[i]:=true;total:=0;try(1);writeln('total:',total);end.【测试数据】n=8 八皇后问题No.[ 1] 1 5 8 6 3 7 2 4 No.[ 2] 1 6 8 3 7 4 2 5 No.[ 3] 1 7 4 6 8 2 5 3 No.[ 4] 1 7 5 8 2 4 6 3 No.[ 5] 2 4 6 8 3 1 7 5 No.[ 6] 2 5 7 1 3 8 6 4 No.[ 7] 2 5 7 4 1 8 6 3 No.[ 8] 2 6 1 7 4 8 3 5 No.[ 9] 2 6 8 3 1 4 7 5 No.[10] 2 7 3 6 8 5 1 4 No.[11] 2 7 5 8 1 4 6 3 No.[12] 2 8 6 1 3 5 7 4 No.[13] 3 1 7 5 8 2 4 6 No.[14] 3 5 2 8 1 7 4 6 No.[15] 3 5 2 8 6 4 7 1 No.[16] 3 5 7 1 4 2 8 6 No.[17] 3 5 8 4 1 7 2 6 No.[18] 3 6 2 5 8 1 7 4 No.[19] 3 6 2 7 1 4 8 5 No.[20] 3 6 2 7 5 1 8 4 No.[21] 3 6 4 1 8 5 7 2 No.[22] 3 6 4 2 8 5 7 1 No.[23] 3 6 8 1 4 7 5 2 No.[24] 3 6 8 1 5 7 2 4 No.[25] 3 6 8 2 4 1 7 5 No.[26] 3 7 2 8 5 1 4 6 No.[27] 3 7 2 8 6 4 1 5 No.[28] 3 8 4 7 1 6 2 5 No.[29] 4 1 5 8 2 7 3 6 No.[30] 4 1 5 8 6 3 7 2 No.[31] 4 2 5 8 6 1 3 7 No.[32] 4 2 7 3 6 8 1 5 No.[33] 4 2 7 3 6 8 5 1 No.[34] 4 2 7 5 1 8 6 3 No.[35] 4 2 8 5 7 1 3 6 No.[36] 4 2 8 6 1 3 5 7No.[37] 4 6 1 5 2 8 3 7 No.[38] 4 6 8 2 7 1 3 5No.[39] 4 6 8 3 1 7 5 2 No.[40] 4 7 1 8 5 2 6 3No.[41] 4 7 3 8 2 5 1 6 No.[42] 4 7 5 2 6 1 3 8No.[43] 4 7 5 3 1 6 8 2 No.[44] 4 8 1 3 6 2 7 5No.[45] 4 8 1 5 7 2 6 3 No.[46] 4 8 5 3 1 7 2 6No.[47] 5 1 4 6 8 2 7 3 No.[48] 5 1 8 4 2 7 3 6No.[49] 5 1 8 6 3 7 2 4 No.[50] 5 2 4 6 8 3 1 7No.[51] 5 2 4 7 3 8 6 1 No.[52] 5 2 6 1 7 4 8 3No.[53] 5 2 8 1 4 7 3 6 No.[54] 5 3 1 6 8 2 4 7No.[55] 5 3 1 7 2 8 6 4 No.[56] 5 3 8 4 7 1 6 2No.[57] 5 7 1 3 8 6 4 2 No.[58] 5 7 1 4 2 8 6 3No.[59] 5 7 2 4 8 1 3 6 No.[60] 5 7 2 6 3 1 4 8No.[61] 5 7 2 6 3 1 8 4 No.[62] 5 7 4 1 3 8 6 2No.[63] 5 8 4 1 3 6 2 7 No.[64] 5 8 4 1 7 2 6 3No.[65] 6 1 5 2 8 3 7 4 No.[66] 6 2 7 1 3 5 8 4No.[67] 6 2 7 1 4 8 5 3 No.[68] 6 3 1 7 5 8 2 4No.[69] 6 3 1 8 4 2 7 5 No.[70] 6 3 1 8 5 2 4 7No.[71] 6 3 5 7 1 4 2 8 No.[72] 6 3 5 8 1 4 2 7No.[73] 6 3 7 2 4 8 1 5 No.[74] 6 3 7 2 8 5 1 4No.[75] 6 3 7 4 1 8 2 5 No.[76] 6 4 1 5 8 2 7 3No.[77] 6 4 2 8 5 7 1 3 No.[78] 6 4 7 1 3 5 2 8No.[79] 6 4 7 1 8 2 5 3 No.[80] 6 8 2 4 1 7 5 3No.[81] 7 1 3 8 6 4 2 5 No.[82] 7 2 4 1 8 5 3 6No.[83] 7 2 6 3 1 4 8 5 No.[84] 7 3 1 6 8 5 2 4No.[85] 7 3 8 2 5 1 6 4 No.[86] 7 4 2 5 8 1 3 6No.[87] 7 4 2 8 6 1 3 5 No.[88] 7 5 3 1 6 8 2 4No.[89] 8 2 4 1 7 5 3 6 No.[90] 8 2 5 3 1 7 4 6No.[91] 8 3 1 6 2 5 7 4 No.[92] 8 4 1 3 6 2 7 5 total:92对于N皇后:┏━━━┯━━┯━━┯━━┯━━┯━━┯━━┯━━┓┃皇后N│ 4 │ 5 │ 6 │ 7│ 8 │ 9 │ 10 ┃┠───┼──┼──┼──┼──┼──┼──┼──┨┃方案数│ 2 │ 10 │ 4 │ 40 │ 92 │352 │724 ┃┗━━━┷━━┷━━┷━━┷━━┷━━┷━━┷━━┛【题目】排球队员站位问题┏━━━━━━━━┓图为排球场的平面图,其中一、二、三、四、五、六为位置编号,┃┃二、三、四号位置为前排,一、六、五号位为后排。

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

COJ/oj/prepare.do?fun=viewProblem&pid=1011/oj/prepare.do?fun=viewProblem&pid=1024/oj/prepare.do?fun=viewProblem&pid=1034/oj/prepare.do?fun=viewProblem&pid=1035/oj/prepare.do?fun=viewProblem&pid=1036/oj/prepare.do?fun=viewProblem&pid=1037/oj/prepare.do?fun=viewProblem&pid=1038/oj/prepare.do?fun=viewProblem&pid=1078/oj/prepare.do?fun=viewProblem&pid=1137/oj/prepare.do?fun=viewProblem&pid=1172/oj/prepare.do?fun=viewProblem&pid=1190/oj/prepare.do?fun=viewProblem&pid=1211/oj/prepare.do?fun=viewProblem&pid=1230/oj/prepare.do?fun=viewProblem&pid=1231/oj/prepare.do?fun=viewProblem&pid=1249:8080/COJ/prepare.do?fun=viewProblem&pid=1257:8080/COJ/prepare.do?fun=viewProblem&pid=1260FOJHotter Colder/problem.php?pid=1014求线段的中位线,线段相交求交点,求凸多边形的面积,无归之室/problem.php?pid=1016本题精度要求非常高,用三角函数的话,很容易就wa..Reflections/problem.php?pid=1035求一条射线遇到圆后的反射光,即圆和直线求交点,求点关于交点法线的对称点。

Pipe/problem.php?pid=1088求一条光线从管道口进入,最远能达到多远。

判断线段左右位置关系,求线段相交交点。

A Pilot in Danger!/problem.php?pid=1120判断点在区域内Area in Triangle/problem.php?pid=1195在三角形内的气球膨胀,求膨胀后的面积。

分情况推公式Triangle/problem.php?pid=1302在给定的n(1<=n<=50000)个点中,取3个点组成三角形,求面积最大。

显然这3个点在凸包上,点集凸包化+凸包上的点k^2(原来要k^3的,利用某些性质剪枝,降到k^2).Area/problem.php?pid=1329Pick定理Center of Gravity/problem.php?pid=1330已知半径,角度的扇形,求其重心到圆心的距离。

Stone/problem.php?pid=1331求多边形的重心Surround the Trees/problem.php?pid=1333凸包Star not a Tree?/problem.php?pid=1355费马点Coplanar Points/problem.php?pid=1393利用差积判断4点共面。

长方形的并的面积/problem.php?pid=1407离散化Common Area/problem.php?pid=1472三角形和圆的共同面积。

弹弓/problem.php?pid=1482n(1<=n<=700)个点中,最多有多少个点在同一条直线上。

牧场/problem.php?pid=1485n(2<=n<=100)个点中,取其中部分点组成的一个凸多边形,求这样的凸多边形的最大顶点数. Oaiei's Trouble/problem.php?pid=1510图形学中的直线剪裁算法,可以用计算几何中的点和线段的关系,线段和线段的求交点来求解。

Defense the country/problem.php?pid=1338Treasure Hunt/problem.php?pid=1332线段相交Minkowski Sum/problem.php?pid=1379Area Ratio/problem.php?pid=1382求三角形的内切圆,外接圆Video Surveillance/problem.php?pid=1032简单题最大可分离值问题/problem.php?pid=1201POJ/JudgeOnline/1031 Fence1039 Pipe1092 Farmland1106 Transmitters1113 Wall1118 Lining Up1133 Stars1151 Atlantis1225 STRICTLY INSCRIBED SIMILAR TRIANGLES 1259 The Picnic1263 Reflections1265 Area1266 Cover an Arc.1269 Intersecting Lines1271 Nice Milk1279 Art Gallery1294 Not Too Convex Hull1319 Pipe Fitters1347 Triangle1361 JaWs1375 Intervals1379 Run A way1389 Area of Simple Polygons1408 Fishnet1410 Intersection1418 V iva Confetti1428 Hermes' Colony1434 Fill the Cisterns!1444 Parallelepiped walk1471 Triangles1473 There's Treasure Everywhere!1494 Sunrise1499 Supercomputer Selection, The Sequel1500 Polygonal Puzzle1514 Metal Cutting1518 Problem Bee1536 Trains1556 The Doors1569 Myacm Triangles1584 A Round Peg in a Ground Hole1586 Three Sides Make a Triangle1605 Horse Shoe Scoring1610 Quad Trees1623 Squadtrees1624 This Takes the Cake1645 BSP Trees1654 Area1660 Princess FroG1673 EXOCENTER OF A TRIANGLE 1685 Color Tunnels1687 Buggy Sat1688 Dolphin Pool1693 Counting Rectangles1696 Space Ant1727 Advanced Causal Measurements (ACM) 1758 Frontier1765 November Rain1774 Fold Paper Strips1803 Box Art1810 Covering1813 Overlapped Shapes1819 Disks1834 线段处理1843 Shire1851 Map1871 Bullet Hole1873 The Fortified Forest1875 Robot1877 Flooded!1881 Sail Race1899 Farmer Bill's Problem1902 Illumination1912 A highway and the seven dwarfs1921 Paper Cut1927 Area in Triangle1931 Biometrics1937 Balanced Food1939 Diplomatic License1940 Polygon Programming with Ease1956 Pumps and Pipes1971 Parallelogram Counting1981 Circle and Points1982 Water Tank2007 Scrambled Polygon2012 Triangle Cuts2016 Ink Blots2026 As the Crow Flies2031 Building a Space Station2036 I Conduit!2043 Area of Polygons2048 Monster Trap2053 Square2066 Minimax Triangulation2069 Super Star2074 Line of Sight2079 Triangle2087 Petanque2098 Ellipse2130 Jogging2149 Inherit the Spheres2150 Crossing Prisms2164 Find the Border2165 Gunman2172 Bricks2177 Ghost Busters2284 That Nice Euler Circuit2621 Parallelepiped2622 Convex hull2686 Traveling by Stagecoach2687 Earth Observation with a Mobile Robot Team 2747 Shy Polygons2839 Convex Hull and Triangle2932 Coneology2954 Triangle3011 Secrets in Shadows3129 How I Wonder What Y ou Are!3130 How I Mathematician Wonder What Y ou Are! 3135 Polygons on the Grid3334 Connected Gheeves3335 Rotating Scoreboard3347 Kadj Squares3384 Feng Shui3407 Brookebond s'en va en guerre...3410 Split convex polygon3608 Bridge Across IslandsZOJzoj相关练习题1597 1608 1648 16831910 2102 2157 23182335 2347 2352 23612370 2375 24032015(中欧1999正赛)2107(浙江2004省赛)2228(北京2004预赛题,难)2234(北京2004预赛题)2214(北京2004正赛题,费马点,知道该知识点=〉易解,否则=〉不可能) 2394(上海2004正赛题)主要内容(仔细核对,看看自己哪些未掌握):判断线段相交;判断直线相交;判断点是否在多边形内;求凸包;凸多边形面积计算;矩形的交与并(扫描法);已知三点求三角形面积(包括海伦公式)和重心;已知三点求外接圆和内接圆圆心、半径、面积;最近点对问题;最远点对问题;点集或图形集合的最小覆盖圆;点集或图形集合的最小覆盖矩形;三角剖分;费尔马点的计算;。

相关文档
最新文档