摘要: Description 你收到一项对数组进行排序的任务,数组中是1到N个一个排列。你突然想出以下一种特别的排序方法,分为以下N个阶段: •阶段1,把数字1通过每次交换相邻两个数移到位置1; •阶段2,用同样的方法把N移到位置N; •阶段3,把数字2移到位置2处; ... 阅读全文
posted @ 2016-07-12 22:00 一个响亮的蒟蒻 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题解We need to find an algorithm of complexity better than O(N3). Here we will describe three such algorithms. The basic idea of the first one ... 阅读全文
posted @ 2016-07-12 20:27 一个响亮的蒟蒻 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Description 二维平面坐标系中有N个点。 从N个点选择3个点,问有多少选法使得这3个点形成直角三角形。Input 第一行包含一个整数N(3hi then begin mid:=(lo+hi) div 2; qsort(l... 阅读全文
posted @ 2016-07-12 20:26 一个响亮的蒟蒻 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 分析这就是裸的矩阵乘法啊!!! 数列f[n]=f[n-1]+f[n-2],f[1]=f[2]=1的前n项和s[n]的快速求法 0 1 0 1 1 1 0 0 1代码const a1:array[1..3,1..3] of int64=((0,1,0), ... 阅读全文
posted @ 2016-07-12 17:07 一个响亮的蒟蒻 阅读(133) 评论(0) 推荐(0) 编辑