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

CCF201909_1

题解:

#include<bits/stdc++.h>
using namespace std;

struct tree {
	int id;
	int apple;
	int cut = 0;
};

bool cmp(tree a, tree b)
{
	if (a.cut == b.cut)
	{
		return a.id < b.id;
	}
	return a.cut > b.cut;
}

int main()
{
	int n, m;
	cin >> n >> m;
	tree t[n];
	int cutNum = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> t[i].apple;
		t[i].id = i + 1;
		for (int j = 0; j < m; j++)
		{
			cin >> cutNum;
			t[i].cut += (-cutNum);
		}
		t[i].apple -= t[i].cut;
	}
	int sum = 0;
	sort(t, t + n, cmp);
	for (int i = 0; i < n; i++)
	{
		sum += t[i].apple;
	}
	cout << sum << " " << t[0].id << " " << t[0].cut << endl;
	return 0;
}


http://www.kler.cn/news/312611.html

相关文章:

  • docker发布redis容器
  • 数据库-约束与多表查询
  • uniapp快速入门教程,内容来源于官方文档,仅仅记录快速入门需要了解到的知识点
  • Java之封装
  • QT --- 初识QT
  • 简单了解 JVM
  • Mac使用技巧-来自苹果专人在线辅导服务2
  • windows环境下载ubuntu22.04源码,提示invalid path aux.c
  • [Visual Stuidio 2022使用技巧]2.配置及常用快捷键
  • LeetCode746:使用花费最小爬楼梯
  • Vue: watch5种监听情况
  • Kubernetes故障排除全面指南
  • Day27_0.1基础学习MATLAB学习小技巧总结(27)——曲线拟合函数
  • Unsupervised Domain Adaptation by Backpropagation
  • 【每日刷题】Day127
  • Scrapy爬虫框架 Spider Middleware 爬虫页中间件
  • 【软件设计】常用设计模式--观察者模式
  • 【小白向】Google Play日区如何支付?Google Play日区怎么转?Google Play日区账号支付教程
  • MongoDB的详细安装教程
  • SpringBoot 消息队列RabbitMQ 消息确认机制确保消息发送成功和失败 生产者确认
  • 普元DWS - Linux下安装DWS标准版
  • AUTOSAR_EXP_ARAComAPI的5章笔记(8)
  • Linux ubuntu debian系统安装UFW防火墙图形化工具GUFW
  • docker- No space left on device
  • 去耦合的一些建议
  • 基于YOLOv5s的无人机航拍输电线瓷瓶检测(附数据集与操作步骤)
  • CVPT: Cross-Attention help Visual Prompt Tuning adapt visual task
  • 云原生-Quarkus
  • 基于Benes网络的SIMD同态密文任意重排
  • HarmonyOS NEXT应用开发案例实践总结合集