CodeForces 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…
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…
题目传送门 /* 贪心:排序后,当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.…
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…
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.…
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…
[链接] 我是链接,点我呀:) [题意] 给你r,g,b三种颜色的气球 每张桌子要放3个气球 但是3个气球的颜色不能全都一样 (允许两个一样,或者全都不一样) 问你最多能装饰多少张桌子 [题解] 先把每张桌子都装饰上 a,b,c三种不同颜色的气球 (显然这样的桌子最多为Math.min(r,g,b)张) 然后把气球的个数减掉 这种方法设置为ABC 然后 肯定只剩两种气球还可能有剩余 那么就用其中数量比较多的一种放2个,比较少的放1个(也是贪心,但不一定对) 这种方法定义为AAB 然后再减少A,B…
题目链接:http://codeforces.com/problemset/problem/359/A 题目意思:给出一个n行m列的table,你需要选择一个good cell(假设为(x, y), 1<=x <=n,1<=y <=m)和任意的一个corner((1, 1), (n, 1), (1, m), (n, m)),此时你可以把这个good cell 和 corner所围住的区域上色,这个区域(p, q)满足 min(good cell的横坐标,corner的横坐标) ≤ …
传送门 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 others. Inspired by the…
题目链接: http://codeforces.com/problemset/problem/650/C 题意: 给定n*m的矩阵,要求用最小的数表示每个元素,其中各行各列的大小关系保持不变. 分析: 将所有元素从小到大排序,然后找到每个元素相应位置进行填充,由于题目要求是每行每列的大小关系保持不变,所以填充的元素应为所在行和所在列中最大元素+1,保存好各行各列当前的最大值,并根据最后填充的元素不断更新就好啦. 问题是如何处理相同元素以及他们所在行列的更新. 这里使用并查集,将相同元素值的位置保…
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的矩阵 让你保持每行每列的大小对应关系不变,将矩阵重写,重写后的最大值最小. 思路:离散化思想+并查集,详见代码 好题! #include <iostream> #include <string.h> #include <stdio.h> #include <algorithm> #include <cmath> #include <cstdlib> #include <bits/stdc++.h> using…
传送门:QAQQAQ 题意:给你一个矩阵只有AGCT,若对于每一个2*2的子矩阵中的四个字母互不相同,则称为这个矩阵是nice的,问至少变矩阵中的几个点可以使矩阵变nice 思路:没什么思路……就是大模拟. 我们先糊出一个结论:对于一个nice矩阵,要么每一行是两个字母循环出现,要么是每一列两个字母循环出现.(所以对于一些无从下手的题可以先模拟几个数据找普遍规律) 所以我们可以枚举左上角的2*2矩阵,再分类是关于行重复还是关于列重复,再关于每一个重复的行或列分类是ABABAB还是BABABA,然…
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…
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…
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 ≤…
题目链接,点击一下 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 - A CodeForces - 478A 注意点: 和为0时要特判一下. 代码: #include<bits/stdc++.h> using namespace std; int main() { int a,b,c,d,e; cin>>a>>b>>c>>d>>e; int sum=0; sum=a+b+c+d+e; if(sum==0) { cout<<-1<<endl; } else { if(sum…
D. The table 题目连接: http://www.codeforces.com/contest/226/problem/D Description Harry Potter has a difficult homework. Given a rectangular table, consisting of n × m cells. Each cell of the table contains the integer. Harry knows how to use two spells…
C. Arthur and Table Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/problem/C Description Arthur has bought a beautiful big table into his new flat. When he came home, Arthur noticed that the new table is unstable. In t…
A. Vanya and Table Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/552/problem/A Description Vanya has a table consisting of 100 rows, each row contains 100 cells. The rows are numbered by integers from 1 to 100 from bottom…
C. GCD Table Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/583/problem/C Description The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest c…
A. Multiplication Table Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/577/problem/A Description Let's consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column co…
题目链接:Codeforces 417E Square Table 题目大意:给出n和m.要求给出一个矩阵,要求每一列每一行的元素的平方总和是一个平方数. 解题思路:构造.依照 a a a b a a a b a a a b c c c d 的方式取构造,然后a,b,c,d的值用随机生成数去枚举,只是我认为用暴力也是能够的. #include <cstdio> #include <cstring> #include <cmath> #include <cstdli…
转载请注明出处:viewmode=contents" target="_blank">http://blog.csdn.net/u012860063?viewmode=contents 题目链接:http://codeforces.com/contest/448/problem/D -----------------------------------------------------------------------------------------------…
题目链接:https://codeforces.com/problemset/problem/1099/E You are given an $n×m$ table, consisting of characters «A», «G», «C», «T». Let's call a table nice, if every $2×2$ square contains all four distinct characters. Your task is to find a nice table (…
C. Table Tennis Game 2 题目连接: http://codeforces.com/contest/765/problem/C Description Misha and Vanya have played several table tennis sets. Each set consists of several serves, each serve is won by one of the players, he receives one point and the lo…