CodeForces 599A Patrick and Shopping】的更多相关文章

水题.每种情况取最小值即可. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; long long d1,d2,d3; int main() { scanf("%lld%lld%lld",&d1,&d2,&d3); long long X,Y,Z; X=min(d1,d2+d3);…
傻逼题,但是我还是wa了一发. #include <iostream> using namespace std; int main() { long long a,b,c,Ans=0x7fffffff; cin >> a >> b >> c; Ans=min(Ans,a+a+b+b); Ans=min(Ans,a+c+b); Ans=min(Ans,a+c+c+a); Ans=min(Ans,b+c+c+b); cout << Ans <&…
A. Patrick and Shopping Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/599/problem/A Description Today Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy some goodies in two…
A. Patrick and Shopping   Today Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy some goodies in two stores located near his house. There is a d1 meter long road between his house and the first shop…
Patrick and Shopping 今天 Patrick 等待着他的朋友 Spongebob 来他家玩.为了迎接 Spongebob,Patrick 需要去他家附近的两家商店  买一些吃的.他家离第一家商店有d1米远,离第二家商店有d2米远.还有,两家商店之间的距离是d3,帮Patrick计算去两家商店然后回家的最短距离. Patrick 永远从他家出发,他不介意重复经过同一个地点或者同一条路,唯一的目标就是:最小化经过两间商店然后回家的距离. Input 第一行的输入包括三个整数 d1,…
Description  meter long road between his house and the first shop and a d2 meter long road between his house and the second shop. Also, there is a road of length d3 directly connecting these two shops to each other. Help Patrick calculate the minimum…
B. Shopping 题目连接: http://www.codeforces.com/contest/665/problem/B Description Ayush is a cashier at the shopping center. Recently his department has started a ''click and collect" service which allows users to shop online. The store contains k items.…
水 A - Patrick and Shopping #include <bits/stdc++.h> using namespace std; int main(void) { int d1, d2, d3; scanf ("%d%d%d", &d1, &d2, &d3); printf ("%d\n", min (min (2 * (min (d1, d2) + d3), 2 * (d1 + d2)), d1 + d2 + d…
目录 Codeforces 1009 A.Game Shopping B.Minimum Ternary String C.Annoying Present D.Relatively Prime Graph E.Intercity Travelling(递推) \(Description\) \(Solution\) F.Dominant Indices(启发式合并) G.Allowed Letters(Hall定理 位运算) \(Description\) \(Solution\) Codef…
Shopping 题目连接: http://codeforces.com/gym/100803/attachments Description Your friend will enjoy shopping. She will walk through a mall along a straight street, where N individual shops (numbered from 1 to N) are aligned at regular intervals. Each shop…
膜拜大佬:https://blog.csdn.net/xyz32768/article/details/88831233 题目链接: http://codeforces.com/contest/1139/problem/F 题意: 有n个物品,物品有三个属性分别是$p_i,s_i,b_i$ 有m个人,人有两个属性分别是$pref_j$,$inc_j$ 一个人能买某个物品必须满足:, $p_i \leq inc_j \leq s_i$ $|b_i-pref_j| \leq (inc_j-p_i)$…
Dish Shopping 将每个物品拆成p 和 s 再加上人排序. 然后问题就变成了, 对于一个线段(L - R), 问有多少个(li, ri)满足  L >= li && R >= ri, 这个东西可以直接树状数组套平衡树维护. 但是这个题目有个特殊性,因为排好序之后不会存在 li > L && ri > R的点, 所以可以直接 用平衡树, 或者线段树去维护这个东西. 平板电视 #include<bits/stdc++.h> #inc…
题目链接:http://codeforces.com/contest/1009/problem/A 解题心得: 题意就是给你两个数列c,a,你需要从c中选择一个子串从a头开始匹配,要求子串中的连续的前k个数都要比对应的a中数小,问k最大是多少. 大比赛的时候自己在枚举题意,搞了好久心态差点崩了. #include <bits/stdc++.h> using namespace std; ; int n,m; int a[maxn],c[maxn]; void init() { scanf(&q…
题目链接: B. Shopping time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output   Ayush is a cashier at the shopping center. Recently his department has started a ''click and collect" service which allow…
暴力 #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include<map> #include<stack> #include<queue> #include<string> #include<algorithm> using namespace std; int n,m,k; ],b[]; int pos(…
B. Spongebob and Joke Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/599/problem/B Description While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Pat…
Fruits Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 12C Description The spring is coming and it means that a lot of fruits appear on the counters. One sunny day little boy Valera deci…
C. Day at the Beach One day Squidward, Spongebob and Patrick decided to go to the beach. Unfortunately, the weather was bad, so the friends were unable to ride waves. However, they decided to spent their time building sand castles. At the end of the…
Description While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of length m, consisting of integers from 1 to n, not…
C. Day at the Beach Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/599/problem/C Description One day Squidward, Spongebob and Patrick decided to go to the beach. Unfortunately, the weather was bad, so the friends were unab…
C. Letter Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/180/problem/C Description Patrick has just finished writing a message to his sweetheart Stacey when he noticed that the message didn't look fancy. Patrick was nervou…
B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed th…
 2017 JUST Programming Contest 2.0 题目链接:http://codeforces.com/gym/101343/problem/A A. On The Way to Lucky Plaza time limit per test:1.0 s memory limit per test:256 MB input:standard input output:standard output Alaa is on her last day in Singapore, s…
题目链接:http://codeforces.com/contest/1009 A. Game Shopping 题目: 题意:有n件物品,你又m个钱包,每件物品的价格为ai,每个钱包里的前为bi.你站在第一件物品前,如果你的第一个钱包能购买这件物品,你第一个钱包的钱直接消失(就相当于你是用第一个钱包里的所有钱购买了这件物品,不会找钱),如果无法购买那么就跳到下一件物品,以此类推,问你总共能购买多少件物品. 思路:直接模拟即可. 代码如下: #include <bits/stdc++.h> u…
F. Souvenirs 题目连接: http://codeforces.com/contest/765/problem/F Description Artsem is on vacation and wants to buy souvenirs for his two teammates. There are n souvenir shops along the street. In i-th shop Artsem can buy one souvenir for ai dollars, a…
B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed th…
C. Woodcutters Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/545/problem/D Description Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For ea…
B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed th…
题目链接 http://codeforces.com/contest/1009 A. Game Shopping 直接模拟即可,用了一个队列来存储账单 #include <iostream> #include <algorithm> #include <queue> #include <stack> #define ll long long using namespace std; ; queue<int> bill; int c[MAX]; i…
B. Spongebob and Joke     While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of length m, consisting of integers fr…