05 2016 档案
摘要:求任意凸多边形的面积 法则是(逆时针坐标乘积-顺时针坐标乘积)÷2 [(x1*y2+x2*y3+x3*y4+x4*y5+x5*y1)-(x1*y5+x2*y1+x3*y2+x4*y3+x5*y4)]/2
阅读全文
摘要:/* 欧拉函数是指n以内与n互质的所有数的个数 通式:sum=x(1-1/p1)(1-1/p2)...(1-1/pn),其中p1, p2……pn为x的所有质因数,x是不为0的整数。 */ #include #include #include #include typedef long long LL; const int N=1000010; using namespace std; L...
阅读全文
摘要:看的别人的博客学的树状数组: http://blog.csdn.net/lulipeng_cpp/article/details/7816527 http://blog.csdn.net/queuelovestack/article/details/47414119
阅读全文
摘要:题意就是从一个无序的数组中找出第k大的数,由于数据很多,容易TLE,而且数组中的元素很大,用hash会MLE; 解法一: 利用STL库函数:nth_element(start, start+n, end)(头文件是<algorithm>) 使第n大元素处于第n位置(从0开始,其位置是下标为n的元素)
阅读全文