C - Sagheer and Nubian Market 思路: 二分: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 1000005 #define ll long long ll n,s,ai[maxn],ci[maxn]; inline void in(ll &now) { ; ') Cget=getchar(); +Cget-',Cget=getchar(); } int main() { ;i&…
On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relatives. The market has some strange rules. It contains n different items numbered from 1 to n. The i-th item has base cost aiEgyptian pounds.…
Sagheer and Nubian Market CodeForces - 812C 题意:n个货物,每个货物基础价格是ai. 当你一共购买k个货物时,每个货物的价格为a[i]+k*i. 每个货物只能购买一次.给你s金币,问你最多可以购买多少个货物,这些货物的最小花费. 题解: 直接二分(1~n)购买数量,每次二分都对每个货物计算价格a[i]+mid*i. 结构体对价格排序,mid个货物总价格大于s的时候break并往小二分,否则往大二分. 数据类型开long long. #include <…
C. Sagheer and Nubian Market time limit per test  2 seconds memory limit per test  256 megabytes   On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relatives. The market has some strange rules.…
题目描述: Sagheer and Nubian Market time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and re…
CF812C Sagheer and Nubian Market 洛谷评测传送门 题目描述 On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relatives. The market has some strange rules. It contains nn different items numbered from 11 to n…
C. Sagheer and Nubian Market time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relat…
On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relatives. The market has some strange rules. It contains n different items numbered from 1 to n. The i-th item has base cost aiEgyptian pounds.…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relatives. The market has some str…
[题目链接]:http://codeforces.com/contest/812/problem/C [题意] 给你n个物品; 你可以选购k个物品;则 每个物品有一个基础价值; 然后还有一个附加价值; 即为k*i; 这里i是这个物品的下标;(1..n中的某个整数); 然后你有预算S; 问你最多能买多少个物品ans; 并求出买ans个物品的最小花费; [题解] 二分买的物品数量k; 然后就能获取出每个物品的价格了; 即a[i]+i*k; 放到b数组里面; 升序排; 然后选取前k个; 看看超不超预算…