- 博客(13)
- 收藏
- 关注
转载 关于已知两点经纬度求球面最短距离的公式推导
已知两点经纬度计算球面距离的公式,一搜一大堆,形式如下:可是至于这个公式为什么是这样的,今天推导了一下,详细推导过程如下。首先画个图(图1),要不然空间想象能力差的话容易犯糊涂。首先对图1做个大致的说明,红色的半圆表示赤道,蓝色的圆弧表示本初子午线(也就是经度为0的子午线)。球最上方是北极点,点A和点B分别为要计算的两个点,坐标分别为A(jA,wA)和B(jB,wB)。
2013-07-31 16:08:48 1697
原创 POJ 1651 / ZOJ 1602 / Northeastern Europe 2001 Multiplication Puzzle(dp)
Multiplication Puzzlehttp://poj.org/problem?id=1651Time Limit: 1000MSMemory Limit: 65536KDescriptionThe multiplication puzzle is played with a row of cards, each contai
2013-07-31 14:57:19 1329
原创 O(NV)的完全背包算法 及 HDU 4508 湫湫系列故事——减肥记I (完全背包)
介绍:完全背包:有N种物品和一个容量为V的背包,每种物品都有无限件可用。放入第i种物品的价值是Wi,所占空间是Ci。求解:将哪些物品装入背包,可使这些物品体积总和不超过背包容量,且价值总和最大。题目可以转化为在Σ(i=1~N) kiCi 思路:temp = f[j - c[i]] + w[i];if (f[j] < temp) f[j] = temp;读
2013-07-31 09:42:53 1183
原创 POJ 1458 / HDU 1159 / Southeastern Europe 2003 Common Subsequence (DP&LCS)
介绍:LCS(最长公共子序列):给两个序列a,b,求出最大公共子序列的长度思路:dp[i][j] = (a[i] == b[j] ? 1 + dp[i - 1][j - 1] : max(dp[i - 1][j], dp[i][j - 1]));代码如下:/*POJ: 0ms,964KB*//*HDU: 31ms,2176KB*/#include
2013-07-30 20:06:00 1258
原创 POJ 1631 / HDU 1950 / ZOJ 1986 / Northwestern Europe 2003 Bridging signals (DP&LIS)
LIS(最长递增子序列):有一列互不相等数arr[n],从中取出k个数使得lis[k]单调递增,求k的最大值。读一个数就计算一次。当它是第一个数时,我们就把它存到lis[1];当它不是第一个数时,就在lis中查找小于它且离它最近的数lis[i],加到lis中(替换掉lis[i+1]),找不到的话就说明它最小,我们替换掉lis[1];注意两点:1. 请使用二分查找
2013-07-30 16:08:35 1439
原创 Beijing 2008 / UVa 1428 / POJ 3928 / HDU 2492 Ping pong (树状数组)
Ping ponghttp://poj.org/problem?id=3928;http://acm.hdu.edu.cn/showproblem.php?pid=2492Time Limit: 1000MSMemory Limit: 65536KDescriptionN(3<=N<=20000) ping pong players
2013-07-27 21:35:34 1053
原创 POJ 3067 Japan(树状数组求逆序对)
Japanhttp://poj.org/problem?id=3067Time Limit: 1000MSMemory Limit: 65536KDescriptionJapan plans to welcome the ACM ICPC World Finals and a lot of roads must b
2013-07-27 12:48:48 1421
原创 POJ 2777 Count Color (线段树&位运算)
Count ColorTime Limit: 1000MS Memory Limit: 65536KDescriptionChosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a
2013-07-26 11:28:58 989
原创 树状数组、线段树模板(一)——单点更新 + HDU 1166 敌兵布阵
http://acm.hdu.edu.cn/showproblem.php?pid=1166此题考查RSQ(Range Sum Query)。模板如下:/*343ms,744KB*//*我们使用如下缩写:root--整棵树的根节点rt--当前区间的根节点l,r--区间左右端点m--区间的二等分点,注意m是落在左子区间的(右端点)lson,rson-
2013-07-26 00:21:10 1117
原创 URAL 1654 Cipher Message(栈)
1654. Cipher MessageTime limit: 1.0 secondMemory limit: 64 MBMüller tried to catch Stierlitz red-handed many times, but always failed because Stierlitz could ever find some excuse. Once
2013-07-25 11:42:50 2084 1
原创 POJ 2524 Ubiquitous Religions (并查集)
Ubiquitous ReligionsTime Limit: 5000MSMemory Limit: 65536KDescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interest
2013-07-25 11:34:56 1404
原创 Beijing 2004 / UVa 1203 / UVALive 3135 / ZOJ 2212 Argus (优先队列)
ArgusTime Limit: 2 Seconds Memory Limit: 65536 KBA data stream is a real-time, continuous, ordered sequence of items. Some examples include sensor data, Internet traffic, financial ticker
2013-07-25 11:13:16 2149
原创 UVa 10282 / POJ 2503 Babelfish / ZOJ 1109 Language of FatMouse (STL&map)
10282 - BabelfishTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1223http://acm.zju.edu.cn/online
2013-07-25 10:45:39 1504
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人