题意:按下列规则生成一组序列,令f(n)为n这个数在序列中出现的最后一个位置,求f(f(n))的值. 1. First, write down 1, 2 on a paper.2. The 2nd number is 2, write down 2 2’s (including the one originally on the paper). The paper thus has 1, 2, 2 written on it.3. The 3rd number is 2, write down…
题意:给一个凸多边形,求任选若干点形成的多边形的面积和. 思路: 按一定方向(顺时针或逆时针)对多边形的顶点进行编号,则多边形的面积计算公式为:f1 x f2 + f2 x f3 + ... fn-1 x fn + fn x f1,fi 表示从参考点到i的向量. 考虑fi x fj 在答案中出现的次数,则答案可以写成:fi x fj * 2n-(j-i+1) (i<j) 或 fi x fj * 2i-j-1(i>j),直接枚举i和j是O(n2)的,显然不行. 由叉积的性质:∑(fi x P)…
Maze Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 3149 Accepted Submission(s): 1370Special Judge Problem Description When wake up, lxhgww find himself in a huge maze. The maze consisted by…