题目链接 : http://codeforces.com/problemset/problem/812/C 题意 : 给你 n 件物品和你拥有的钱 S, 接下来给出这 n 件物品的价格, 这些物品的价值不是固定不变的, 价格的变化公式是 a[i]+k*i (i代表第 i 件物品, k 代表你选择买的物品数量, a[i]为物品的底价), 现问你最多能够买多少件物品和所买物品总和, 输出时应该使得所买物品总和尽量小 分析 : 如果我当前能买 k 件物品, 那我肯定能买数量小于 k 的物品, 如果我当…
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 <…
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…
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.…
题目链接:http://codeforces.com/contest/812/problem/B 题意 : 给出一个 n (1 ≤ n ≤ 15)层的教学楼, 每一层楼包含 m (1 ≤ m ≤ 100)个房间, 另外每一层的两边还有楼梯口, 接下来有n 行每行有 m+2(包含楼梯口) 用0和1来表示这栋楼的信息, 0代表这个房间的灯没亮, 1代表亮, 现在保安在整栋楼的左下角的楼梯口, 他的目的是关掉这栋楼所有的灯, 而且保安在上楼时他所在的当前楼层灯需全灭才能继续上楼, 而且每经过一个房间和…
傻逼二分 #include<cstdio> #include<algorithm> using namespace std; typedef long long ll; ll a[100010],b[100010],sum; int n,m; bool check(int x){ for(int i=1;i<=n;++i){ b[i]=a[i]+(ll)i*(ll)x; } sum=0; sort(b+1,b+n+1); for(int i=1;i<=x;++i){ s…
模拟赛给他们出T1好了~ code: #include <bits/stdc++.h> #define ll long long #define N 100006 #define setIO(s) freopen(s".in","r",stdin) using namespace std; int n; ll a[N],ck,A[N],S; int check(int tmp) { int i,cnt=0; for(i=1;i<=n;++i) A[…
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.…
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…
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&…