CodeForces 19B Checkout Assistant】的更多相关文章

B. Checkout Assistant time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Bob came to a cash & carry store, put n items into his trolley, and went to the checkout counter to pay. Each item is d…
题意: 给你n个物品,每个物品有一个价格ci和一个支付时间ti,在这个ti时间内,你可以免费拿ti个物品.问你想要带走这n个物品最小需要多少钱 题解: 原本还想着贪心去写,但是好像贪心写不了,,,不属于贪心   因为题目上说了要求把n个商品都买下所付出的最小的钱因为买了第i件商品可以免费拿出来ti个,可以相当于一共拿出来ti+1个那么这就相当于01背包了,n当作背包体积.但是要注意,如果背包剩余空间不够当前操作导致无法求出最优解呢?所以背包剩余体积就算不够也可以放进去(具体见代码)     代码…
http://codeforces.com/problemset/problem/19/B 对于每个物品,能偷多ti个,那么先让ti + 1, 表示选了这个东西后,其实就是选了ti + 1个了.那么只需要选出>=n个即可. 一开始的时候想不到ti + 1,一直不知道能多选ti个后,本来是选了多少个. #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #inc…
题目描述 Bob 来到一家现购自运商店,将 n 件商品放入了他的手推车,然后到收银台 付款.每件商品由它的价格 pi 和收银员扫描它的时间 ti 秒定义.当收银员正在扫 描某件商品时,Bob 可以从他的手推车中偷走某些其它商品.Bob 需要恰好 1 秒 来偷走一件商品.Bob 需要付给收银员的最少钱数是多少?请记住,收银员扫描 商品的顺序由 Bob 决定. 输入格式 输入第一行包含数 n(1≤n≤2000).接下来 n 行每行每件商品由 一对数 ti,ci(0≤ti≤2000,1≤ci≤10^9…
A. World Football Cup #include <bits/stdc++.h> using namespace std;   ; char name[N][N]; map<string, int> mp; char s[N];   struct P { int id, point; int dif, goal; bool operator < (const P &rhs) const { if (point == rhs.point &&…
前言 从后往前刷 update 新增 \(\text{\color{red}{Mark}}\) 标记功能,有一定难度的题标记为 \(\text{\color{red}{红}}\) 色. 题单 (刷过的题就会登记在上面) 2B The least round way 只有 \(2^a*5^b\) 尾随'\(0\)'的个数为 \(\text{min}(a,b)\),dp一遍就好了 4D Mysterious Present 5C Longest Regular Bracket Sequence [C…
A. Puzzles Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/337/A Description The end of the school year is near and Ms. Manana, the teacher, will soon have to say goodbye to a yet another class. She decided to p…
A. Straight «A» time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Noora is a student of one famous high school. It's her final year in school — she is going to study in university next year.…
A. Straight «A» 题面 Noora is a student of one famous high school. It's her final year in school - she is going to study in university next year. However, she has to get an «A» graduation certificate in order to apply to a prestigious one. In school, w…
Puzzles Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 337A64-bit integer IO format: %I64d      Java class name: (Any) The end of the school year is near and Ms. Manana, the teacher, will soon have t…