CF459B Pashmak and Flowers (水】的更多相关文章

Pashmak and Flowers Codeforces Round #261 (Div. 2) B. Pashmak and Flowers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pashmak decided to give Parmida a pair of flowers from the garden.…
B. Pashmak and Flowers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pashmak decided to give Parmida a pair of flowers from the garden. There are n flowers in the garden and the i-th of t…
题目链接:http://codeforces.com/problemset/problem/459/B 题意: 给出n支花,每支花都有一个漂亮值.挑选最大和最小漂亮值得两支花,问他们的差值为多少,并且有多少种选法(无先后顺序). 现场做时,想到的是:用multimap记录每个漂亮值出现的次数,并不断更新最大最小值. 这个方法很笨,而且multimap的val值是多余的. 需要注意特殊情况:max==min 代码如下: #include<iostream>//A - Pashmak and Fl…
Pashmak decided to give Parmida a pair of flowers from the garden. There are nflowers in the garden and the i-th of them has a beauty number bi. Parmida is a very strange girl so she doesn't want to have the two most beautiful flowers necessarily. Sh…
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…
Problem Description As you know, Gardon trid hard for his love-letter, and now he's spending too much time on choosing flowers for Angel. When Gardon entered the flower shop, he was frightened and dazed by thousands kinds of flowers. "How can I choos…
题目链接: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…
题目链接:http://codeforces.com/problemset/problem/459/A 题目大意: 给出两个点(在坐标轴中),求另外两个点从而构成一个正方形,该正方形与坐标轴平行. 如果给的点构不成与坐标轴平行的正方形,则输出 -1. 两点范围: x1, y1, x2, y2 ( - 100 ≤ x1, y1, x2, y2 ≤ 100) .所求两点范围: x3, y3, x4, y4 ( - 1000 ≤ x3, y3, x4, y4 ≤ 1000). 解题思路: 给出两个点,…
http://codeforces.com/contest/459 A题 Pashmak and Garden 化简化简水题,都告诉平行坐标轴了,数据还出了对角线,后面两个点坐标给的范围也不错 #include <cstdio> int x[4],y[4]; int abs(int n){ return n<0?-n:n; } int main(){ scanf("%d%d%d%d",x,y,x+1,y+1); int dx=abs(x[0]-x[1]); int d…
每个标题都做了题目原网址的超链接 Day11<Given Length and Sum of Digits...> 题意: 给定一个数 m 和 一个长度 s,计算最大和最小在 s 长度下,各位数字之和为 m 的值 如果无法生成,则输出两个-1 题解: 需要注意:在输出最大值时,判一下 k 是否为 0 上板子: #include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int le…