一品网
  • 首页

P2512 [HAOI2008]糖果传递


P2512 [HAOI2008]糖果传递

img

#include
using namespace std;
typedef long long ll;
#define debug(x) cout<<#x<<':'<vc;ll ave=0;vc.push_back(0);
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        ave+=a[i];
    }
    ave/=n;
    for(int i=2;i<=n;i++){
        vc.push_back(vc[i-2]+ave-a[i]);
    }
    sort(vc.begin(),vc.end());//选中位数,即n/2;
    ll ans=0;
    for(int i=0;i
每日一题

相关


【LeetCode每日一题】员工的重要性

【LeetCode每日一题】整数反转

【python】Leetcode每日一题-森林中的兔子

【python】Leetcode每日一题-132模式

【每日一题】【链表】2021年11月20日-141. 环形链表

每日一题-Day31-删除链表的倒数第n个节点

每日一题·暑假 week1

【每日一题】【栈】【递归】【遍历】2021年12月1日-94. 二叉树的中序遍历

# 每日题目-1.6:每日一题+49+50

【每日一题】【list转int数组】【Lambda的简化-方法引用】2022年1月15日-NC45 实现二

【每日一题】【找到位置返回&升序数组中第K大就是n-K小】2022年1月17日-NC88 寻找第K

【每日一题】【map操作】【滑动窗口所需元素】2021年12月22日-76. 最小覆盖子串

标签

一品网 冀ICP备14022925号-6