Codeforces 892 A.Greed】的更多相关文章

A. Greed time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai  ≤  bi). Jaf…
A  链接:http://codeforces.com/problemset/problem/892/A 签到 #include <iostream> #include <algorithm> using namespace std; ]; int main() { int n; ,sum2=; cin>>n; ; i<n; ++i) cin>>a,sum1+=a; ; i<n; ++i) cin>>b[i]; sort(b,b+n)…
题目链接:https://cn.vjudge.net/problem/CodeForces-892A Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai  ≤  bi). Jafar has decided to pour all remaining cola into just 2 cans, determin…
C. Pride time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have an array a with length n, you can perform operations. Each operation is like this: choose two adjacent elements from a, sa…
D. Gluttony time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array a with n distinct integers. Construct an array b by permuting a such that for every non-empty subset of i…
B. Wrath time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Hands that shed innocent blood! There are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings a…
A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000. This new device is equipped wi…
题目链接:http://codeforces.com/problemset/problem/892/A 具体的Java 中 sort实现降序排序:https://www.cnblogs.com/youpeng/p/10546797.html Ac代码: import java.util.Comparator; import java.util.Scanner; import static java.util.Arrays.sort; public class Main { public stat…
A. Greed time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai  ≤  bi). Jaf…
C. Pearls in a Row There are n pearls in a row. Let's enumerate them with integers from 1 to n from the left to the right. The pearl number i has the type ai. Let's call a sequence of consecutive pearls a segment. Let's call a segment good if it cont…