数学
flowser
you are what you want to be
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
uva11300 - Spreading the Wealth (中位数)
题意: n个人(1,2,…n),围成圈站(即第一个人左边是最后一个人),每个人有一定金币数,可将金币转移左右相邻的人,合理分配使得每个人的金币数相同,求分配过程中需转移金币的最小值。 思路: 1 给 2 x2 个金币 2 给 3 x3 个金币 k 给 k+1 k+1个金币 n 给 1 x1 个金币 Aver = a1 - x2 + x1原创 2016-01-24 14:07:02 · 392 阅读 · 0 评论 -
LA3708 - Graveyard (等比缩放)
题意: 周长为10000的圆,等距分布n个点,加入m个点后,求要使n+m等分布,所要移动的最小距离。 思路: 等比缩放,将圆缩小为周长为n+m的圆 代码: #include #include #include #include #include #include using namespace std; int main(){ int n,原创 2016-01-24 15:08:16 · 359 阅读 · 0 评论 -
uva10041 - Vito's Family(求中位数)
题意: 给你一些房屋的坐标,让你求一个点使得到这些房屋距离最小 思路: 题目要求的其实就是中位数 代码:#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std;const int N = 505; int s[N]; int main() { i原创 2016-03-09 21:41:07 · 342 阅读 · 0 评论 -
uva270 - Lining Up(几何 - 最大共线点)
题意: 给你一堆二维点,求最大共线点数 思路: 暴力,先枚举前两个点,第三个点则采用三点共线公式: (x2-x1)/(y2-y1)=(x3-x2)/(y3-y2) ->(x2-x1)(y3-y2) = (x3-x2)(y2-y1)代码:#include <iostream> #include <cstdio> #include <cstring> #include <algorithm>原创 2016-02-26 22:28:34 · 390 阅读 · 0 评论 -
uva10341 - Solve It
题意: 求满足方程 p ∗ e−x + q ∗ sin(x) + r ∗ cos(x) + s ∗ tan(x) + t ∗ x*x + u = 0 的解x 思路: 这题用数学中在某区间求根的步骤+二分判断来写,比如区间【0,1】中有根,0与1 带入方程后所得的乘积就会小于0点点点 代码如下:#include <iostream> #include <cstdio> #include <原创 2016-02-26 22:33:21 · 268 阅读 · 0 评论 -
uva10700- Camel trading
Sample Input 3 1+2*3*4+5 4*18+14+7*10 3+11+4*1*13*12*8+3*3+8 Sample Output The maximum and minimum are 81 and 30. The maximum and minimum are 1560 and 156. The maximum and minimum are 339768 an原创 2016-02-28 22:34:30 · 362 阅读 · 0 评论 -
uva11100 - The Trip, 2007
题意: n个整数,要把不相同的放在一堆,求至少几堆,并把它们逐堆从小到大输出。 思路: 相同数字的不能放在一起,所以最大相同数个数就是所求,然后分包时要把它们隔开,如113455556667789,就有至少要4堆,要把5555给隔开装,这样的话就每个数字加4一包这样。代码如下:#include <iostream> #include <cstdio> #include <cstring> #i原创 2016-02-14 20:14:41 · 968 阅读 · 0 评论
分享