题目链接 有红绿蓝三种颜色的画,每种拿三朵可以组成一束花,或者各拿一朵组成花束,告诉你每种花的数目,求出可能组成最多的花束. 如果你的代码过不了,考虑一下 8 8 9这种组合. 因为数据量很大,我的思想就是局部和总体采用不同的策略. #include <iostream> #include <algorithm> using namespace std; int main() { int r, g, b; while (cin >> r >> g >…
题目链接 题意: 有n个男孩和m个女孩,他们要结对跳舞,每对要有一个女孩和一个男孩,而且其中一个要求之前没有和其他人结对,求出最大可以结多少对. 如图,一条线代表一对,只有这样三种情况. #include <iostream> #include <algorithm> #include <stdio.h> using namespace std; int main() { int n, m; while (cin >> n >> m) { int…
B. Ciel and Flowers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Fox Ciel has some flowers: r red flowers, g green flowers and b blue flowers. She wants to use these flowers to make seve…
题目链接:http://codeforces.com/problemset/problem/459/B 题目意思:有 n 朵 flowers,每朵flower有相应的 beauty,求出最大的beauty 差 和 要达到这个最大的差 的取法有多少种. 一下子wa,是因为没考虑到整个序列都是相同的beauty 时的情况,以为取法是一种= =.注意,beauty 差为0都是合法的.还有注意这句话:Two ways are considered different if and only if the…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Little Alyona is celebrating Happy Birthday! Her mother has an array of n flowers. Each flower has some mood, the mood of i-th flower is ai. The…
Fox Ciel is playing a card game with her friend Jiro. Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Ciel's cards…
Discription Devu wants to decorate his garden with flowers. He has purchased n boxes, where the i-th box contains fi flowers. All flowers in a single box are of the same color (hence they are indistinguishable). Also, no two boxes have flowers of the…
传送门 解题思路: 假如只有 s 束花束并且不考虑 f ,那么根据隔板法的可重复的情况时,这里的答案就是 假如说只有一个 f 受到限制,其不合法时一定是取了超过 f 的花束 那么根据组合数,我们仍然可以算出其不合法的解共有: 最后,由于根据容斥,减两遍的东西要加回来,那么含有偶数个 f 的项为正,奇数个时为负. 答案就是: 搜索答案,使用Lucas定理,计算组合数上下约去. 代码: #include<cstdio> #include<cstring> #include<alg…
B. Ciel and Flowers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Fox Ciel has some flowers: r red flowers, g green flowers and b blue flowers. She wants to use these flowers to make seve…
A. Ciel and Dancing 模拟. B. Ciel and Flowers 混合类型的数量只能为0.1.2,否则3个可以分成各种类型各自合成. C. Ciel and Robot 考虑一组命令得到的点集,那么后面的点的起始点会对应于其中点集中的一个点. D. Ciel and Duel 两种策略: atk-atk:一个取最小的前若干个,一个取最大的若干个. atk-def.atk:对于def状态的,需要优先取最靠近的值抵消,剩余atk状态的也是取最近的. E. Ciel the Co…
Fox And Jumping CodeForces - 510D Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0. There are also n cards, each card…
Fox And Two Dots CodeForces - 510B Fox Ciel 正在玩一个手机拼图游戏,被称之为 "Two Dots".基础关卡是在一个大小为 n × m的棋盘上游戏,类似于这样: 每个单元格包含了一个具有某种颜色的点.我们将使用不同的大写拉丁字符,表示不同的颜色. 这个游戏的关键是,找到同色环.例如,考虑图上的 4 个蓝色点,它们形成了一个环.正式地,我们将一个点序列 d1, d2, ..., dk 称作一个环 ,当且仅当它满足以下的条件: 这 k 个点不同:…
E. Ciel the Commander Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/322/problem/E Description Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its name said, has n cities connected by n - 1 undirected ro…
C. Watering Flowers 题目连接: http://www.codeforces.com/contest/617/problem/C Descriptionww.co A flowerbed has many flowers and two fountains. You can adjust the water pressure and set any values r1(r1 ≥ 0) and r2(r2 ≥ 0), giving the distances at which t…
E. Devu and Flowers 题目连接: http://codeforces.com/contest/451/problem/E Description Devu wants to decorate his garden with flowers. He has purchased n boxes, where the i-th box contains fi flowers. All flowers in a single box are of the same color (hen…
话说好久没写算法代码了,工作了有点忙的了.只是算法始终是我的挚爱,故此还是尽量抽时间和挚爱来个约会. Codeforces的题目是最适合练手的了,以下是一道不算难的动态规划法题目.先上题: D. Flowers time limit per test1.5 seconds memory limit per test256 megabytes inputstandard input outputstandard output We saw the little game Marmot made f…
Ciel the Commander Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 321C64-bit integer IO format: %I64d Java class name: (Any) Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its na…
D. Flowers time limit per test:1.5 seconds memory limit per test:256 megabytes We saw the little game Marmot made for Mole's lunch. Now it's Marmot's dinner time and, as we all know, Marmot eats flowers. At every dinner he eats some red and white flo…
题目描述: Ciel the Commander time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its name said, has n cities connected by n - 1 undire…
B. Alyona and flowers Problem Description: Let's define a subarray as a segment of consecutive flowers. The mother suggested some set of subarrays. Alyona wants to choose several of the subarrays suggested by her mother. After that, each of the flowe…