首页 > TAG信息列表 > Kangaroos

[CodeForces] A. Counting Kangaroos is Fun

A. Counting Kangaroos is Fun   There can be only at most N / 2 hold and held pairs based the problem's statment. So a greedy approach is just to divide A into smaller and bigger groups, then try to match two groups greedily.   1. Sort A; 2. from A[0]

[CodeForces 372A] Counting Kangaroos is Fun

题目链接:http://codeforces.com/problemset/problem/372/A 二分思想 AC代码: #include <cstdio> #include <algorithm> using namespace std; int arr[500005]; int main() { int n; while(scanf("%d",&n) != EOF) { for(int i = 0;i <

【Codeforces 372A】Counting Kangaroos is Fun

【链接】 我是链接,点我呀:) 【题意】 如果a[i]*2<=a[j]那么i袋鼠可以装进j袋鼠里面 每只袋鼠都只能装一只袋鼠 【题解】 假设最后的方案是(ai,bi) 这里(ai,bi)表示下标为ai的袋鼠可以装进下标为bi的袋鼠里面 (这里袋鼠已经按照大小从小到大排序了) 则我们会发现,如果有(a1