学习:https://blog.csdn.net/qq_21334057/article/details/99550805 题意:从nn个点中选择kk个点构成多边形,问期望面积. 题解:如果能够确定两个点,那么可以从这两个点之间选择k−2个点来构成一个k边形.所以可以枚举两个点,计算这两个点被选入构成凸包的概率和对凸包贡献的面积. #include <bits/stdc++.h> #define fopi freopen("in.txt", "r", s…
题目链接: A - Piece of Cake Kattis - pieceofcake 题目大意:给你一个多边形,然后给你这个多边形的每个点的坐标,让你从这个n个点中选出k个点,问这个k个点形成的面积的期望. 具体思路:我们肯定不能硬跑每一个k边形,肯定会超时.我们以每个点作为起点,从这个点开始,形成的面积的期望是多少,然后遍历每一个点,这样算出来的会有重复,最后除以2就可以了. 然后算面积的时候,我们分开算.一个多边形的面积等于每个点按照顺时针或者是逆时针两个点之间的叉积. 求组合数的时候,…
原文:Win8 Metro(C#)数字图像处理--2.74图像凸包计算 /// <summary> /// Convex Hull compute. /// </summary> /// <param name="points">The source image points.</param> /// <param name="startPoints"></param> /// <para…
Cake Time Limit: 1 Second Memory Limit: 32768 KB You want to hold a party. Here's a polygon-shaped cake on the table. You'd like to cut the cake into several triangle-shaped parts for the invited comers. You have a knife to cut. The trace of each cut…
Description You want to hold a party. Here's a polygon-shaped cake on the table. You'd like to cut the cake into several triangle-shaped parts for the invited comers. You have a knife to cut. The trace of each cut is a line segment, whose two endpoin…
题目来源:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=45  SCUD Busters  Background Some problems are difficult to solve but have a simplification that is easy to solve. Rather than…
传送门 题意:给nnn个A∗BA*BA∗B的矩形,其中每个矩形的四个角被改造成了半径为rrr的四分之一 圆,问这些矩形的凸包周长. 思路:考虑求出圆心的凸包周长然后加上一个整圆的周长,证明很简单,略掉. 代码: #include<bits/stdc++.h> #define ri register int using namespace std; const int N=10005; struct pot{ double x,y; friend inline pot operator+(con…
看图片的隐写术自闭,本来想看一看jarvisoj 的basic放松一下心情,结果一道题就做了一晚上qwq 首先看到这道题的时候想到的是凯撒密码(这其实是Google之后才知道这个名字的)枚举了26种位移,发现都不可读. 心态爆炸,只能猜到是以一种奇怪的方式做一一替换后的结果,依稀想起了之前听说过的词频分析法,不会操作,就可耻地看了题解. get提示替换式密码,而且题目十分良心地没有去掉空格,难度下降了不少,有单独的一个x,推测是a,nit出现的次数极多,推测是the,在python中不断地替换,…
https://scut.online/contest/25/I 由结论:d维物体切n刀分成的部分=sum(C(n,0)~C(n,d)),直接算就行了.…
遵从题意枚举暴力读人n,再求出$\sum^n_1a[i]*i$然后输出答案,(记得开个long long以免炸掉)以下是代码: #include<bits/stdc++.h> using namespace std; long long n,a,sum; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a; sum+=i*a; } cout<<sum<<endl; return 0; }…