CodeForces Round #296 Div.2】的更多相关文章

Codeforces Round #296 (Div. 1)C. Data Center Drama Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  Solved: 2xx 题目连接 http://codeforces.com/contest/528/problem/C Description The project of a data center of a Big Software Company consists of n compu…
http://codeforces.com/contest/528/problem/E 先来吐槽一下,一直没机会进div 1, 马力不如当年, 这场题目都不是非常难,div 2 四道题都是水题! 题目大意:给n条直线,保证直线两两不平行,保证三条直线不公点.然后,随机挑三条直线,构成一个三角形,问挑出的三角形的面积的期望. 换句话说,就是算出全部三角形的面积和.再除以三角形的数量.后者是C(n,3), 关键是三角形面积和怎样计算. 下面给我我的思路:O(n^2) 基于三角形的向量表示法, S(A…
题目传送门 /* 无算法 三种可能:1.交换一对后正好都相同,此时-2 2.上面的情况不可能,交换一对后只有一个相同,此时-1 3.以上都不符合,则不交换,-1 -1 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <map>…
题目传送门 /* 水题 a或b成倍的减 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <map> #include <set> #include <vector> #include <set&…
A. Playing with Paper 如果a是b的整数倍,那么将得到a/b个正方形,否则的话还会另外得到一个(b, a%b)的长方形. 时间复杂度和欧几里得算法一样. #include <iostream> #include <cstdio> using namespace std; //const int maxn = ; int main() { //freopen("in.txt", "r", stdin); ; scanf(&q…
A. Playing with Paper One day Vasya was sitting on a not so interesting Maths lesson and making an origami from a rectangular a mm  ×  b mm sheet of paper (a > b). Usually the first step in making an origami is making a square piece of paper from the…
A:模拟辗转相除法时记录答案 B:3种情况:能降低2,能降低1.不能降低分别考虑清楚 C:利用一个set和一个multiset,把行列分开考虑.利用set自带的排序和查询.每次把对应的块拿出来分成两块插入回去.然后行列分别取最大相乘的作为这次询问的答案 D:一个区间覆盖问题的变形.注意公式的话.非常easy发现事实上x.w相应的就是一个[x - w, x + w]的区间,然后求最多不重合区间就可以 代码: #include <cstdio> #include <cstring> #…
B - Clique Problem 题目大意:给你坐标轴上n个点,每个点的权值为wi,两个点之间有边当且仅当 |xi - xj| >= wi + wj, 问你两两之间都有边的最大点集的大小. 思路:其实问题能转换为一堆线段问你最多能挑出多少个线段使其两两不相交.. 对于一个点来说可以变成[x - wi, x + wi]这样一条线段.. 然后贪心取就好啦. #include<bits/stdc++.h> #define LL long long #define fi first #def…
B. Clique Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as f…
A. Glass Carving time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a re…