• ## Polygon

万次阅读 2021-02-28 21:16:08
Polygon is a game for one player that starts on a polygon with N vertices, like the one in Figure 1, where N=4. Each vertex is labelled with an integer and each edge is labelled with either the symbol...
Polygon is a game for one player that starts on a polygon with N vertices, like the one in Figure 1, where N=4. Each vertex is labelled with an integer and each edge is labelled with either the symbol + (addition) or the symbol * (product). The edges are numbered from 1 to N.  On the first move, one of the edges is removed. Subsequent moves involve the following steps: �pick an edge E and the two vertices V1 and V2 that are linked by E; and �replace them by a new vertex, labelled with the result of performing the operation indicated in E on the labels of V1 and V2. The game ends when there are no more edges, and its score is the label of the single vertex remaining.
Consider the polygon of Figure 1. The player started by removing edge 3. After that, the player picked edge 1, then edge 4, and, finally, edge 2. The score is 0.  Write a program that, given a polygon, computes the highest possible score and lists all the edges that, if removed on the first move, can lead to a game with that score.
输入描述:
Your program is to read from standard input. The input describes a polygon with N vertices. It contains two lines. On the first line is the number N. The second line contains the labels of edges 1, …, N, interleaved with the vertices’ labels (first that of the vertex between edges 1 and 2, then that of the vertex between edges 2 and 3, and so on, until that of the vertex between edges N and 1), all separated by one space. An edge label is either the letter t (representing +) or the letter x (representing *).
3 <= N <= 50
For any sequence of moves, vertex labels are in the range [-32768,32767].
输出描述:
Your program is to write to standard output. On the first line your program must write the highest score one can get for the input polygon. On the second line it must write the list of all edges that, if removed on the first move, can lead to a game with that score. Edges must be written in increasing order, separated by one space. 示例1 输入 4 t -7 t 4 x 2 x 5 输出 33 1 2
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=125;
int f[N][N],f1[N][N],a[N],n;
char b[N];
int main()
{
scanf("%d",&n);
memset(f,-0x3f,sizeof(f)), memset(f1,0x3f,sizeof(f1));
for(int i=1;i<=n;i++)
{
getchar();
scanf("%c%d",&b[i],&a[i]);
b[i+n]=b[i];a[i+n]=a[i];
}
for(int i=1;i<=2*n;i++) f1[i][i]=f[i][i]=a[i];
for(int i=2;i<=n;i++)
for(int l=1;l<=n*2-i+1;l++)
{
int r=l+i-1;
for(int k=l;k<r;k++)
if(b[k+1]=='t') f[l][r]=max(f[l][r],f[l][k]+f[k+1][r]),f1[l][r]=min(f1[l][r],f1[l][k]+f1[k+1][r]);
else
{
f[l][r]=max(f[l][r],f[l][k]*f[k+1][r]);
f[l][r]=max(f[l][r],f1[l][k]*f1[k+1][r]);
f1[l][r]=min(f1[l][r],f1[l][k]*f1[k+1][r]);
f1[l][r]=min(f1[l][r],f[l][k]*f1[k+1][r]);
f1[l][r]=min(f1[l][r],f1[l][k]*f[k+1][r]);
}
}
int maxx=-0x7fffffff;
for(int i=1;i<=n;i++)
maxx=max(maxx,f[i][i+n-1]);
printf("%d\n",maxx);
for(int i=1;i<=n;i++)
if(f[i][n-1+i]==maxx)
printf("%d ",i);
return 0;
}

展开全文
• void polygon( const POINT *points, int num ); 参数 points 每个点的坐标，数组元素个数为 num。 该函数会自动连接多边形首尾。 num 多边形顶点的个数。 返回值 无 示例 以下代码片段绘制一个三角形...
这个函数用于画无填充的多边形。
void polygon(
const POINT *points,
int num
);

参数
points
每个点的坐标，数组元素个数为 num。 该函数会自动连接多边形首尾。
num
多边形顶点的个数。
返回值
无
示例
以下代码片段绘制一个三角形(两种方法)：
// 方法 1
POINT pts[] = { {50, 200}, {200, 200}, {200, 50} };
polygon(pts, 3);

// 方法 2
int pts[] = {50, 200,  200, 200,  200, 50};
polygon((POINT*)pts, 3);
展开全文
• 该文档为Polygon字体，是一份很不错的参考资料，具有较高参考价值，感兴趣的可以下载看看
• 模型减面 Polygon Cruncher Polygon Cruncher Polygon Cruncher 批量转换工具
• uniyt Polygon 低模场景 ，底模角色20个。手游Dome资源。
• A closed polygon is called convex if the line segment joining any two points of the polygon lies in the polygon. Figure 1 shows a closed polygon which is convex and one which is not convex. ...
• boost::polygon模块实现自定义polygon相关的测试程序实现功能C++实现代码 实现功能 boost::polygon模块实现自定义polygon相关的测试程序 C++实现代码 #include <boost/polygon/polygon.hpp> #include <...


boost::polygon模块实现自定义polygon相关的测试程序

实现功能
C++实现代码

实现功能
boost::polygon模块实现自定义polygon相关的测试程序
C++实现代码
#include <boost/polygon/polygon.hpp>
#include <cassert>
#include <list>
namespace gtl = boost::polygon;
using
展开全文
• pip installPolygon 只能使用pip installPolygon2 或者 pip installPolygon3，也就是必须带版本号 我的只能安装Polygon3，安装完引用报错，缺少geos_c.dll 实际上是shapely需要geos from shapely.geos import...

pip install Polygon
只能使用pip install Polygon2 或者 pip install Polygon3，也就是必须带版本号

我的只能安装Polygon3，安装完引用报错，缺少geos_c.dll
实际上是shapely需要geos
from shapely.geos import lgeos
win10系统下，
pip install shapely 成功

把shapely\DLLs下面的dll拷贝到
C:\ProgramData\Miniconda3\Library\bin
然后就解决了
shapely\DLLs路径：

这次没用后面的方法了：
geos_c.dll x64版本下载：
下载后存放路径：
D:\Users\Administrator\miniconda3\Library\bin\geos_c.dll
展开全文
• boost::polygon模块实现polygon set相关的测试程序实现功能C++实现代码 实现功能 boost::polygon模块实现polygon set相关的测试程序 C++实现代码 #include <boost/polygon/polygon.hpp> #include <list>...
• inpolygon True for points inside or on a polygonal region. IN = inpolygon(X,Y,XV,YV) returns a matrix IN the size of X and Y. IN(p,q) = 1 if the point (X(p,q), Y(p,q)) is either strictly inside or ...
• In a rectilinear polygon there are at least 4 vertices and every edge is either horizontal or vertical; each vertex is an endpoint of exactly one horizontal edge and one vertical edge. There are no ...
• 关于Polygon Soup的理解 什么是Polygon Soup 最近看的CG方面的论文中多次出现了Polygon Soup这个单词，中文直译过来是“多边形汤”，有点懵逼，于是查了一些资料了解了一下大致意思。先从维基百科上看起。 From ...
• 这个 Truffle Polygon 框为您提供了开始为 Polygon 的以太坊 L2 解决方案编码所需的样板结构，即 Polygon PoS 链（以前称为 Matic PoS 链）。 有关 Polygon PoS 链如何工作的详细信息，请在此处查看其文档。 作为...
• <p>But their is a problem, I wanted to use your solution for polygon (and not polyline), it works fine except for one thing. The creation of new point during "snapping" <p>Imagine my case : I&...
• win 安装Polygon.pdf
• Polygon Mesh Processing 多边形网格处理绝对不容错过的经典书籍
• locality_polygon 测试更新
• POLYGON - Knights Pack 1.2.7z
• git clone https://github.com/plotx/token-Polygon.git 现在，是时候安装依赖项了。 输入智能合约目录并使用 npm install 如果需要，可以使用以下命令运行测试用例 npm run test 并使用生成运行覆盖率报告 npm run ...
• pytorch-polygon-rnn Pytorch实现。 注意，我使用另一种方法来处理第一个顶点，而不是像本文中那样训练另一个模型。 与原纸的不同 我使用两个虚拟起始顶点来处理第一个顶点，如图像标题所示。 我需要在ConvLSTM层...
• A polygon is a plane figure that is bounded by a finite amount of straight line segments closing in a loop to form a closed polygonal chain. The segments are called its edges, and the points wher...

...