当前位置: 首页 > news >正文

江苏建设人才网网站圣玺企业网站建设

江苏建设人才网网站,圣玺企业网站建设,坂田的做网站公司,企业网络营销策划论文目录 1 基础知识2 模板3 工程化 1 基础知识 暂无。。。 2 模板 暂无。。。 3 工程化 题目1#xff1a;排队打水。给定N个数#xff0c;表示装满每个桶所需的时间#xff0c;请你安排打水顺序#xff0c;使得等待时间最小#xff0c;并输出该最小值。 解题思路#… 目录 1 基础知识2 模板3 工程化 1 基础知识 暂无。。。 2 模板 暂无。。。 3 工程化 题目1排队打水。给定N个数表示装满每个桶所需的时间请你安排打水顺序使得等待时间最小并输出该最小值。 解题思路将所需时间小的桶排在前面。 C代码如下 #include iostream #include vector #include algorithmusing namespace std;int main() {int n;cin n;vectorint nums;for (int i 0; i n; i) {int x;cin x;nums.emplace_back(x);}sort(nums.begin(), nums.end());long long res 0;for (int i 0; i n; i) {res nums[i] * (n - i - 1);}cout res endl;return 0; }题目2货仓选址问题。给定N个数求一个数x使得这N个数减去x的绝对值之和最小输出这个最小值。 解题思路贪心做法。当n为奇数时x取中位数当n为偶数时x取这两个中位数之间包含这两个中位数的任意一个数即可。 C代码如下 #include iostream #include algorithm #include vectorusing namespace std;int main() {int n; cin n;vectorint nums(n);for (int i 0; i n; i) cin nums[i];sort(nums.begin(), nums.end());long long res 0;for (int i 0; i n; i) res abs(nums[i] - nums[n/2]);cout res endl;return 0; }题目3耍杂技的牛。有N头牛它有重量和强壮值两个属性将它们堆叠起来某头牛的风险值等于其上所有牛的重量减去自身的强壮值。N头牛总共有N个风险值有一个最大风险值。不同的排序方式会有不同的最大风险值求其最小值。 解题思路按照重量和强壮值之和从小到大排序这是最优的排序方式会获得最小的最大风险值。 C代码如下 #include iostream #include algorithm #include vectorusing namespace std;int main() {int n;cin n;vectorpairint,int nums;for (int i 0; i n; i) {int w, s;cin w s;nums.emplace_back(w,s);}sort(nums.begin(), nums.end(), [](const pairint,int a, const pairint,int b) {return a.first a.second b.first b.second; });long long res -2e9;long long sum 0;for (auto [w, s] : nums) {res max(res, sum - s);sum w;}cout res endl;return 0; }
http://www.pierceye.com/news/535999/

相关文章:

  • 阳江营销型网站建设wordpress防攻击插件
  • 深圳电信网络建站东莞房价2022最新价格
  • 昆山营销型网站建设温州网上商城网站建设
  • 网站html动态效果asp化妆品网站源码
  • 丹东网站seo国家企业工商网查询
  • 好看云在线网站模板江西省建设厅教育网站
  • 小网站百度做一个网站怎么做呢
  • 城市分站seoseo相关岗位
  • 购物网站开发语言wordpress分类指定页面
  • 中企动力做网站的优势做招聘网站经营范围
  • 重庆企业网站排名优化方法百度录入网站
  • 做薪酬调查有哪些网站校园二手交易网站设计的原则
  • 建设电子商务网站的方法有?网站架构图
  • 网站运营阶段wordpress首页没有显示文章图片
  • 2个小时学会网站建设手机兼职快递录单员
  • 以前有个自助建设网站东莞路桥投资建设公司招聘
  • 电子游艺网站开发常德seo技术
  • 河北邢台wap网站建设南昌网页制作
  • 山东建设人才网站高端母婴网站模板
  • 物业服务网站建设佛山做网站公司有哪些
  • 企业网站模板中文网站域名名字
  • 在服务器网站上做跳转网页设计代码动漫
  • 科协网站建设的意见合肥哪里有做网页的地方
  • 为企业做网站策划案永康网站推广
  • 做个企业网网站怎么做linux建网站
  • 专业建站公司主要做什么wordpress加入下载标签
  • 韩都衣舍网站建设方案美食网站怎么做dw
  • 电商网站开发 参考文献wordpress验证码注册
  • ic外贸网站建设wordpress和shopex
  • 网站技术制作流程图国内顶尖小程序开发公司