CF-478C Table Decorations (贪心)】的更多相关文章

Table Decorations Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 478C Description You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactl…
Table Decorations Time limit per test: 1 second Memory limit per test: 256 megabytes Problem Description 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…
题目传送门 /* 贪心:排序后,当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; 隔了一段时间有做到这题又不会了,看别人的解题报告水平果然没有提升,以后做题要独立思考,看别人的也要…
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.…
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 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 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 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…
[链接] 我是链接,点我呀:) [题意] 给你r,g,b三种颜色的气球 每张桌子要放3个气球 但是3个气球的颜色不能全都一样 (允许两个一样,或者全都不一样) 问你最多能装饰多少张桌子 [题解] 先把每张桌子都装饰上 a,b,c三种不同颜色的气球 (显然这样的桌子最多为Math.min(r,g,b)张) 然后把气球的个数减掉 这种方法设置为ABC 然后 肯定只剩两种气球还可能有剩余 那么就用其中数量比较多的一种放2个,比较少的放1个(也是贪心,但不一定对) 这种方法定义为AAB 然后再减少A,B…
题目链接: 传送门 Lawnmower time limit per test:2 second     memory limit per test:256 megabytes Description You have a garden consisting entirely of grass and weeds. Your garden is described by an n × m grid, with rows numbered 1 to n from top to bottom, an…
Soldier and Badges time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Colonel has n badges. He wants to give one badge to every of his n soldiers. Each badge has a coolness factor, which show…
Anya and Ghosts time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots…
题面: 传送门 思路: 一眼看得,这是贪心[雾] 实际上,我们要求的答案就是sigma(ci*(ti-i))(i=1~n),这其中sigma(ci*i)是确定的 那么我们就要最小化sigma(ci*ti) 所以在新的每一秒,就把这一秒开始可以起飞的飞机中,cost最大的那一个拿出来,让他起飞就可以了 证明: 设最大的为m,我们取得另一个为n 那么n*ti+m*(ti+1) >= n*(ti+1)+m*ti 所以取m最好 这个过程用堆实现,懒得手打了,就用了priority_queue Code:…
题目链接: 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, zip algorithms and many o…
传送门 解题思路 贪心.对于一段区间中,可以将这段区间中相同的元素同时变成\(c\),但要付出的代价是区间中等于\(c\)的数的个数,设\(sum[i]\)表示等于\(c\)数字的前缀和,Max[i]表示数字\(i\)的最大个数.那么只要\(O(n)\)的扫一遍,维护一下每个数字的\(max\),具体做法是看一下\(Max[a[i]]\)大还是\(sum[i]\)大,如果\(sum\)大的话,说明前面都不变,直接把\(Max\)赋值成\(sum[i]+1\),否则直接让\(Max[i]++\),…
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. Three balloons attac…
题意: m个水果,n个价格.每种水果只有一个价格. 问如果给每种水果分配价格,使得买的m个水果总价格最小.最大. 输出最小值和最大值. 思路: 贪心. 代码: bool cmp(int a,int b){ return a>b; } string name; map<string,int> mp; int price[200],fruit[200]; int cn; int n,m; int main(){ cin>>n>>m; mp.clear(); cn=0;…
题目链接: 传送门 Discounts time limit per test:3 second     memory limit per test:256 megabytes Description One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as…
题目链接: 传送门 Playlist time limit per test:1 second     memory limit per test:256 megabytes Description Manao's friends often send him new songs. He never listens to them right away. Instead, he compiles them into a playlist. When he feels that his mind…
Amr and Music time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Amr is a young coder who likes music a lot. He always wanted to learn how to play music but he was busy coding so he got an ide…
(- ̄▽ ̄)-* //把最大单独放,然后第二大的和最小的放一起,第三大的和第二小的放一起 //由此类推,求最大值,即为盒的最小值 #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #include<cstring> #include<string> #include<cstdlib> #include<vector>…
(- ̄▽ ̄)-* #include<iostream> #include<cstdio> #include<cstring> using namespace std; ; char s[MAXN]; int main() { int n; scanf("%d",&n); scanf("%s",s);//输入01串 ,flip=; ;i<strlen(s);i++) { ]) flip++;//00或11 else o…
题目链接,点击一下 Round#273 Div.2 ================== problem A Initial Bet ================== 很简单,打了两三场的cf第一次在10分钟内过题 判平均数,且注意b为正 #include<iostream> using namespace std; int main() { ,n; ; i < ; i++) { cin>>n; res += n; } ; == && b) cout<…
A. Initial Bet time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are five people playing a game called "Generosity". Each person gives some non-zero number of coins b as an initial…
Oracle 性能之 Enq: CF - contention Table of Contents 1. 原因 2. 解决问题 2.1. 针对持有锁进程类型处理 2.1.1. 查看持有锁会话的进程类型 2.1.2. 根据进程类型采取不同的处理方法 2.2. 检查归档路径 3. 总结 1 原因 只要是需要读控制文件的操作期间,都调用并持有 CF enqueue, CF 块用于控制文件相关事务的序列化 操作和在控制文件共享部分的读写操作. 一般来说,控制文件的CF enqueue 锁的申请和持有时间…
Table Decorations CodeForces - 478C 你有r个红的,g个绿的和b个蓝的气球.要为宴会布置一张桌子,你恰好需要三个气球.附在桌子上的三个气球不应该有相同的颜色.如果我们知道每种颜色的气球的数量,最多可以装饰多少张桌子? 您的任务是编写一个程序,对于给定的值r.g和b,它将找到表的最大数量t,并且可以按照所需的方式进行装饰. Input The single line contains three integers r, g and b (0 ≤ r, g, b ≤…
A. Initial Bet 题意:给出5个数,判断它们的和是否为5的倍数,注意和为0的情况 #include<iostream> #include<cstdio> #include<cstring> #include <cmath> #include<algorithm> using namespace std; typedef long long LL; int main() { ; ;i<=;i++){ cin>>x; s…
0.95版本hbase 单机模式下所有的服务都运行在一个JVM上,包括HBase和zookeeper.使用的是本地文件系统 日志默认放在目录下logs文件夹中 基本命令: create 'table','cf'  //创建一个table名字的表,cloumn family为cf put 'table','row1','cf:a','value1' //插入table表中一条数据,row1为key值,a为列名,value1为值 list ‘table’  //列出所有的表.table不是表名 sc…
參考(向原作者致敬) http://ydt619.blog.51cto.com/316163/1230586 https://blogs.apache.org/flume/entry/streaming_data_into_apache_hbase flume 1.5 的配置文件演示样例 #Name the components on this agent a1.sources = r1 a1.sinks = k1 a1.channels = c1 # Describe/configure th…