Codeforces 260B - Ancient Prophesy】的更多相关文章

260B - Ancient Prophesy 思路:字符串处理,把符合条件的答案放进map里,用string类中的substr()函数会简单一些,map中的值可以边加边记录答案,可以省略迭代器访问部分. 代码: #include<bits/stdc++.h> using namespace std; ; map<string,int>mp; string s; ]={,,,,,,,,,,,}; bool isOK(string s) { ]!=]!='-')return fals…
[codeforces 260]B. Ancient Prophesy 试题描述 A recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is a string that only consists of digits and characters "-". We'll say that some date is mentioned in the P…
A recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is a string that only consists of digits and characters "-". We'll say that some date is mentioned in the Prophesy if there is a substring in the Pr…
传送门 题意 给出一正多边形三顶点的坐标,求此正多边形的面积最小值. 分析 为了叙述方便,定义正多边形的单位圆心角u为正多边形的某条边对其外接圆的圆心角(即外接圆的某条弦所对的圆心角). (1)多边形的边数未知,但其外接圆是确定的.多边形的外接圆即三个顶点所构成三角形的外接圆.面积最小即边数最少,单位圆心角最大. (2)设三角形某两边所对的圆心角为a1, a2 (expressed in radians),则最大单位圆心角为 u= gcd(a1, a2, 2PI-a1-a2). 思路 (1)三点…
原文链接https://www.cnblogs.com/zhouzhendong/p/CF1045E.html 4K码量构造题,CF血腥残暴! 题解 首先,如果所有点颜色相同,那么直接连个菊花搞定. 然后我们建个凸包. 如果凸包上有大于2段颜色(就是至少四段),比如这样 那么必然无解. 否则就只有一段颜色或者两段颜色: 这里我们先不管这个,考虑一个三角形的构造. 考虑三角形三个顶点颜色不全相同的情况,例如: (两个白点的情况是等价的) 假如三角形区域内没有白点,那么直接全部连到其中一个黑点就好了…
A. Adding Digits 枚举. B. Ancient Prophesy 字符串处理. C. Balls and Boxes 枚举起始位置\(i\),显然\(a_i \le a_j, 1 \le j \le n\), 同时\(i+1\)到\(x\)之间数需要大于\(a_i\),那么只要处理下区间最值即可. D. Black and White Tree 当\(s_i\)是最小值时,点\(i\)是个叶子节点,那么在不同颜色中的集合中找另一点连接即可. E. Dividing Kingdom…
参考:NENU CS ACM模板made by tiankonguse  2.13 GCD 快速gcd: 位操作没学,真心不懂二进制,还是得学啊 code: int kgcd(){ if(!a || !b) return a?a:b; ) && !(b&)) ,b>>)<<; )) ); )) ,b); return kgcd(b,a%b); } 在说fgcd之前先说一下fmod函数吧 fmod: 原型:extern float fmod(float x,…
B. Ancient Berland Hieroglyphs 题目连接: http://codeforces.com/problemset/problem/164/B Descriptionww.co Polycarpus enjoys studying Berland hieroglyphs. Once Polycarp got hold of two ancient Berland pictures, on each of which was drawn a circle of hierog…
D. New Year and Ancient Prophecy 题目连接: http://www.codeforces.com/contest/611/problem/C Description Limak is a little polar bear. In the snow he found a scroll with the ancient prophecy. Limak doesn't know any ancient languages and thus is unable to u…
C. Ancient Berland Circus 题目连接: http://www.codeforces.com/contest/1/problem/C Description Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different. In Ancient Berland arenas in circuses were s…