acgo题库
  • 首页
  • 题库
  • 学习
  • 天梯
  • 备赛

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
  • 资讯
  • 竞赛
  • 讨论
  • 团队
  • 商城
登录
注册
题目详情提交记录(0)
  • 题解#1

    这是一道排序+模拟题。核心是按(s+z)(s+z)(s+z)降序,sss降序,编号升序排序,前mmm筐按p1p1p1计价,其余按p2p2p2计价。 注意点: 排序键是s+zs + zs+z,两者最大都是1e91e91e9,和最大2e92e92e9,intintint勉强够但建议用longlonglong longlonglong更稳妥。 cic_ici 最大1e41e41e4,nnn最大2e52e52e5,苹果总数最多2e92e92e9,再乘单价1e91e91e9,结果会爆intintint,必须用longlonglong longlonglong。 链接描述

    userId_undefined
    黄昏中的落雁
    倔强青铜快乐小狗2月全勤卷王
    11阅读
    0回复
    2点赞
  • 解:

    #include <bits/stdc++.h> using namespace std; struct Apple { long long s, z, c; int id; }; bool cmp(Apple a, Apple b) { if (a.s + a.z != b.s + b.z) return a.s + a.z > b.s + b.z; if (a.s != b.s) return a.s > b.s; return a.id < b.id; } int main() { int n, m; long long p1, p2; cin >> n >> m >> p1 >> p2; } | --- ---

    userId_undefined
    牛牛哦
    时间刺客倔强青铜字符串·魔法使模拟·模拟练习生枚举·枚举小能手
    6阅读
    0回复
    0点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页