CodeForces 670D2 Magic Powder - 2 (二分)】的更多相关文章

题意:今天我们要来造房子.造这个房子需要n种原料,每造一个房子需要第i种原料ai个.现在你有第i种原料bi个.此外,你还有一种特殊的原料k个, 每个特殊原料可以当作任意一个其它原料使用.那么问题来了,你最多可以造多少个房子呢? 析:首先可以先把开始能造出的先处理出来,然后再进行二分,当然也可以直接进行二分. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #inc…
D2. Magic Powder - 2 The term of this problem is the same as the previous one, the only exception — increased restrictions. Input The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ 109) — the number of ingredients and the…
D1. Magic Powder - 1 题目连接: http://www.codeforces.com/contest/670/problem/D1 Description This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single soluti…
D2. Magic Powder - 2 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The term of this problem is the same as the previous one, the only exception — increased restrictions. Input The first l…
http://codeforces.com/problemset/problem/670/D2 http://codeforces.com/problemset/problem/670/D1 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The term of this problem is the same as the p…
D1. Magic Powder - 1 time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output This problem is given in two versions that differ only by constraints. If you can solve this problem in large constr…
二分. 二分一下答案,然后验证一下. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #include<map> #include<set> #include<…
D2. Magic Powder - 2 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The term of this problem is the same as the previous one, the only exception — increased restrictions. Input The first l…
题目链接:http://codeforces.com/contest/670/problem/D2 This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find t…
http://codeforces.com/problemset/problem/670/D2 The term of this problem is the same as the previous one, the only exception — increased restrictions. Input The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ 109) — the nu…