Codeforces Round #100 A. New Year Table】的更多相关文章

A. New Year Table time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Gerald is setting the New Year table. The table has the form of a circle; its radius equals R. Gerald invited many guests…
题目传送门 /* 贪心:排序后,当a[3] > 2 * (a[1] + a[2]), 可以最多的2个,其他的都是1个,ggr,ggb, ggr... ans = a[1] + a[2]; 或先2个+1个,然后k个rgb...r = x + k; g = 2 * (x + z) + k; b = z + k; ans = (x + z) + k = (a[1] + a[2] + a[3]) / 3; 隔了一段时间有做到这题又不会了,看别人的解题报告水平果然没有提升,以后做题要独立思考,看别人的也要…
CodeForces - 233D 题目大意给你一个n*m 的矩阵,要求你进行涂色,保证每个n*n的矩阵内都有k个点被涂色. 问你一共有多少种涂色方案. n<=100 && m<=1e18 看数据范围感觉是个矩阵快速幂优化的dp,各种想,连状态转移方程都想不出来,我真 鸡儿菜!!!!,这种和概率有关的dp我感觉好蓝啊!!! 思路:显然是个dp,我们另dp[ i ][ j ]表示,到 i 列,一共涂了j个格子的种数, 那么有状态转移方程 dp[ i ][ j ] +=Σ(dp[…
题目链接: http://codeforces.com/problemset/problem/650/C C. Table Compression time limit per test4 secondsmemory limit per test256 megabytes 问题描述 Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and m…
E. Table Compression 题目连接: http://www.codeforces.com/contest/651/problem/E Description Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and many others. Inspired by the new knowledge, Petya is now…
http://codeforces.com/contest/478/problem/C C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have r red, g green and b blue balloons. To decorate a single table for…
C. Table Compression Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and many others. Inspired by the new knowledge, Petya is now developing the new compression algorithm which he wants to name d…
140 A. New Year Table 题目大意:有一个大圆桌子,半径是R, 然后有n个半径是r的盘子,现在需要把这些盘子摆放在桌子上,并且只能摆放在桌子边缘,但是不能超出桌子的范围....问能放摆放下. 分析:先求出如果可以摆放n个盘子的最大夹角a,然后计算出来两个圆之间的距离,就可以判断出来是否能摆放下,注意1的时候需要特殊判断. #include<stdio.h> #include<math.h> const double PI = acos(-1.0); ; int S…
C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons.…
C. Table Decorations   You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number t of tables can b…
题目链接: http://codeforces.com/problemset/problem/140/E 题意: 圣诞树上挂彩球,要求从上到下挂\(n\)层彩球.已知有\(m\)种颜色的球,球的数量不限. 要求结果对\(p\)取模.然后给你\(n\)个数,表示第 \(i\) 根绳长 \(l_i\),也就是要挂 \(l_i\) 个球. \(1.\)要求每根绳上相邻彩球颜色不同. \(2.\)相邻的绳子上挂的彩球种类不能相同. 题解: 我们先解决子问题,先考虑第 \(i\) 层上能放多少个球,\(a…
E. Table Compression time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zipalgorithms and many others.…
Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and many others. Inspired by the new knowledge, Petya is now developing the new compression algorithm which he wants to name dis. Petya decided to…
#include <iostream> #include <vector> using namespace std; int main(){ int n,m; cin >> n >> m; ][]; bool flag = false; ; i < n ; ++ i){ ; j < m ; ++ j){ cin >> a[i][j]; } } ; j < m; ++ j){ ][j] || a[n-][j]){ flag = t…
C题, #include<cstdio> #include<cstring> #include<algorithm> #define maxn 5005 using namespace std; int num[maxn]; int rmq(int l,int r) { <<,tmp=l; for(int i=l;i<=r;i++) { if(ans>num[i]) { ans=num[i]; tmp=i; } } return tmp; } i…
题目链接 题意: n*m的一个乘法表,从小到大排序后,输出第k个数  (1 ≤ n, m ≤ 5·105; 1 ≤ k ≤ n·m) 分析: 对于k之前的数,排名小于k:k之后的数大于,那么就能够採用二分. LL n, m, k; LL fun(LL goal) { LL t = 0, ret = 0; while (++t <= m) { ret += min(n, goal / t); } return ret; } LL bin(LL L, LL R, LL goal) { LL M, V…
传送门 首先先从小到大排序,如果没有重复的元素,直接一个一个往上填即可,每一个数就等于当前行和列的最大值 + 1 如果某一行或列上有重复的元素,就用并查集把他们连起来,很(不)显然,处于同一行或列的相同元素始终应该保持一样的,然后再一个一个往上填 #include <bits/stdc++.h> #define N 1000007 #define fi first #define se second using namespace std; pair <int, pair<int,…
题目传送门 /* 水题:读懂题目就能做 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <string> #include <queue> #include <map> #include <se…
E. Runaway to a Shadow 题目连接: http://www.codeforces.com/contest/681/problem/E Description Dima is living in a dormitory, as well as some cockroaches. At the moment 0 Dima saw a cockroach running on a table and decided to kill it. Dima needs exactly T…
Codeforces Round #713 (Div. 3) Editorial 记录一下自己写的前二题本人比较菜 A. Spy Detected! You are given an array a consisting of n (n≥3) positive integers. It is known that in this array, all the numbers except one are the same (for example, in the array [4,11,4,4]…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
 cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....       其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…
Codeforces Round #270 1002 B. Design Tutorial: Learn from Life time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One way to create a task is to learn from life. You can choose some experience…
Codeforces Round #346 (Div. 2)---E. New Reform E. New Reform time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Berland has n cities connected by m bidirectional roads. No road connects a city…
Codeforces Round #108 (Div. 2) C. Pocket Book 题意 给定\(N(N \le 100)\)个字符串,每个字符串长为\(M(M \le 100)\). 每次选择\(i, j, k\),然后交换串\(i\)和串\(j\)的长度为\(k\)的前缀. 操作可以做任意次,求最多能得到多少不同的字符串,\(modulo (10^9+7)\). 思路 相当于每个位置的可选字符为该列的不同字符的数量. 代码 C. Pocket Book D. Frames 题意 给定…
Codeforces Round #110 (Div. 2) C. Message 题意 给两个长度不超过2000的字符串\(s,u\),仅由小写字母构成. 找出\(s\)的一个子串\(t\),通过3种操作变换成字符串\(u\): 在首或尾添加一个字符; 删除首或尾的一个字符; 改变某个位置的字符. 求最小的操作步数. 思路 因为删除.插入的代价和修改的代价一样,显然找出和\(u\)长度一样的子串\(t\)可以求得最小代价. 显然\(u\)可以只匹配\(s\)的一个前缀或后缀,可以通过在\(s\…
A. Sereja and Dima time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sereja and Dima play a game. The rules of the game are very simple. The players have n cards in a row. Each card contains…
Hard problem 题目链接: http://codeforces.com/contest/706/problem/C Description Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase Engl…
Interesting drink 题目链接: http://codeforces.com/contest/706/problem/B Description Vasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As all programmers do, he loves the famous drink "Beecola", which can be bough…
Beru-taxi 题目链接: http://codeforces.com/contest/706/problem/A Description Vasiliy lives at point (a, b) of the coordinate plane. He is hurrying up to work so he wants to get out of his house as soon as possible. New app suggested n available Beru-taxi…