思路:

如果所有的图形都是三角形,那么答案是2*n+1

否则轮廓肯定触到了最上面,要使轮廓线最短,那么轮廓肯定是中间一段平的

我们考虑先将轮廓线赋为2*n+2,然后删去左右两边多余的部分

如果最左边或最由边是正方形,那么不需要删

如果最左边或最由边是圆形,那么删取2 - pi/2

如果如果最左边或最由边是三角形,那么我们需要找到一段连续的三角形,然后考虑怎么删去

#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pi acos(-1.0)
#define LL long long
//#define mp make_pair
#define pb push_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define ULL unsigned LL
#define pll pair<LL, LL>
#define pii pair<int, int>
#define piii pair<pii, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stout);
//head int main() {
fio;
int n;
string s;
cin >> n;
cin >> s;
bool f = true;
for (int i = ; i < n; i++) if(s[i] != 'T') f = false;
if(f) {
cout << *n + << endl;
}
else {
double ans = *n + ;
if(s[] == 'T') {
int x = ;
for (int i = ; i < n; i++) {
if(s[i] == 'T') {
x++;
}
else if(s[i] == 'C'){
double tot = x + 0.5;
double t = sqrt((sqrt()/ - 0.5)*(sqrt()/ - 0.5) + x*x - 0.25);
tot -= t;
double a = atan((sqrt()/ - 0.5) / x);
double b = atan(t*);
double c = pi/ -a - b;
tot -= c*0.5;
ans -= tot;
break;
}
else if(s[i] == 'S') {
double tot = x;
double t = sqrt((-sqrt()/)*(-sqrt()/) + (x-0.5) * (x-0.5));
tot -= t;
ans -= tot;
break;
}
}
}
else if(s[] == 'C') {
ans -= - pi/;
} reverse(s.begin(), s.end());
if(s[] == 'T') {
int x = ;
for (int i = ; i < n; i++) {
if(s[i] == 'T') {
x++;
}
else if(s[i] == 'C'){
double tot = x + 0.5;
double t = sqrt((sqrt()/ - 0.5)*(sqrt()/ - 0.5) + x*x - 0.25);
tot -= t;
double a = atan((sqrt()/ - 0.5) / x);
double b = atan(t*);
double c = pi/ -a - b;
tot -= c*0.5;
ans -= tot;
break;
}
else if(s[i] == 'S') {
double tot = x;
double t = sqrt((-sqrt()/)*(-sqrt()/) + (x-0.5) * (x-0.5));
tot -= t;
ans -= tot;
break;
}
}
}
else if(s[] == 'C') {
ans -= - pi/;
}
cout << fixed << setprecision() << ans << endl;
}
return ;
}

Codeforces 101173 C - Convex Contour的更多相关文章

  1. [CERC2016]:凸轮廓线Convex Contour(模拟+数学)

    题目描述 一些几何图形整齐地在一个网格图上从左往右排成一列.它们占据了连续的一段横行,每个位置恰好一个几何图形.每个图形是以下的三种之一:$1.$一个恰好充满单个格子的正方形.$2.$一个内切于单个格 ...

  2. UVALive 7749 Convex Contour (计算几何)

    题意:给定上正方形,圆,三角形,让你求出包围它的最短的路径. 析:首先,如果是这种情况  三角形 三角形 三角形 正方形(圆) 三角形 三角形 三角形 ..这一种就是直接从左边直接连到正方形(圆),也 ...

  3. 【计算几何】【分类讨论】Gym - 101173C - Convex Contour

    注意等边三角形的上顶点是卡不到边界上的. 于是整个凸包分成三部分:左边的连续的三角形.中间的.右边的连续的三角形. 套个计算几何板子求个三角形顶点到圆的切线.三角形顶点到正方形左上角距离啥的就行了,分 ...

  4. codeforces B. Convex Shape 解题报告

    题目链接:http://codeforces.com/problemset/problem/275/B 题目内容:给出一个n * m 大小的grid,上面只有 black 和 white 两种颜色填充 ...

  5. Codeforces 838E Convex Countour

    题 OvO http://codeforces.com/contest/838/problem/E (IndiaHacks 2nd Elimination 2017 (unofficial, unra ...

  6. Codeforces.838E.Convex Countour(区间DP)

    题目链接 \(Description\) 给定一个n边凸多边形(保证没有三点共线),求一条经过每个点最多一次的不会相交的路径,使得其长度最大.输出这个长度. \(Solution\) 最长路径应该是尽 ...

  7. Codeforces Round #270 1003

    Codeforces Round #270 1003 C. Design Tutorial: Make It Nondeterministic time limit per test 2 second ...

  8. codeforces 70D Professor's task(动态二维凸包)

    题目链接:http://codeforces.com/contest/70/problem/D Once a walrus professor Plato asked his programming ...

  9. Codeforces Round #328 (Div. 2) B. The Monster and the Squirrel 打表数学

    B. The Monster and the Squirrel Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/c ...

随机推荐

  1. day28 网络编程

    网络编程 什么是网络编程? 编写基于网络的应用程序的过程称之为网络编程 一.CS构架 C/S构架 服务器和客户端之间用网线连接 提供数据的计算机称为服务器,访问数据的计算机称为客户端 二.网络通讯的基 ...

  2. python --- 14 递归 二分法查找

    一.递归 1.函数自己调用自己 2.官方说明最大深度1000,但跑不到1000,要看解释器, 实测998 3.使⽤递归来遍历各种树形结构 二.    二分法查找 掐头结尾取中间 ,  必须是有序序列 ...

  3. xlrd、xlwt 操作excel表格详解

    转自:https://www.cnblogs.com/jiablogs/p/9141414.html python操作excel主要用到xlrd和xlwt这两个库,即xlrd是读excel,xlwt是 ...

  4. Python中的open和codecs.open

    最近老被编码困扰,多次折腾之后,感觉python的编解码做得挺好的,只要了解下边的流程,一般都能解决 input文件(gbk, utf-8...) ----decode-----> unicod ...

  5. C# DateTime判断时间

    两种情况: 1 DateTime? dtTemp = null; if(dtTime != null) { //wawawa } 刚刚学会的,可空值类型,可判断是否赋值 2 DateTime dtTe ...

  6. C# 各种控件实现可拖动和调整大小

    http://www.360doc.com/content/18/0516/12/55659281_754382494.shtml using System; using System.Collect ...

  7. delimiters 插值 选项

    delimiters差值选项vue默认是{{}},这个选项可以把这个差值形式进行改变,这里讲,默认插值改成${} html <div id="app"> <div ...

  8. DPDK安装方法 17.12.13

    DPDK安装方法 17.12.13 Ubuntu: $ git clone https://github.com/DPDK/dpdk.git $ cd dpdk/ $ export RTE_ARCH= ...

  9. Git回顾

    抄自廖雪峰的官方网站 完整图文请访问https://github.com/Mrlution/study/tree/master/git 关于repository 我认为repository是一个存放代 ...

  10. Codeforces Round #117 (Div. 2) D.Common Divisors(KMP最小循环节)

    http://codeforces.com/problemset/problem/182/D 题意:如果把字符串a重复m次可以得到字符串b,那么我们称字符串a为字符串b的一个因子,现在给定两个字符串S ...