A1113 | Integer Set Partition (25)
太简单了
#include <stdio.h>
#include <memory.h>
#include <math.h>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <map> #define I scanf
#define OL puts
#define O printf
#define F(a,b,c) for(a=b;a<c;a++)
#define FF(a,b) for(a=0;a<b;a++)
#define FG(a,b) for(a=b-1;a>=0;a--)
#define LEN 100000
#define MAX 0x06FFFFFF
#define V vector<int> using namespace std; int a[LEN];//1e6 int main(){
freopen("d:/input/A1113/2.txt","r",stdin);
int i=,n;
scanf("%d",&n);
while(i<n){
scanf("%d",&a[i]);
i++;
}
int sl=,sr=;
int mid=n/;//[0,mid),[mid,n)
sort(a,a+n);
FF(i,mid) sl+=a[i];
F(i,mid,n) sr+=a[i];
O("%d %d",n%,abs(sl-sr));
return ;
}
A1113 | Integer Set Partition (25)的更多相关文章
- PAT A1113 Integer Set Partition (25 分)——排序题
Given a set of N (>1) positive integers, you are supposed to partition them into two disjoint set ...
- A1113. Integer Set Partition
Given a set of N (> 1) positive integers, you are supposed to partition them into two disjoint se ...
- 1113. Integer Set Partition (25)
Given a set of N (> 1) positive integers, you are supposed to partition them into two disjoint se ...
- PAT甲级——A1113 Integer Set Partition
Given a set of N (>) positive integers, you are supposed to partition them into two disjoint sets ...
- PAT (Advanced Level) 1113. Integer Set Partition (25)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- 【PAT甲级】1113 Integer Set Partition (25分)
题意: 输入一个正整数N(2<=N<=1e5),接着输入N个正整数,将这些数字划分为两个不相交的集合,使得他们的元素个数差绝对值最小且元素和差绝对值最大. AAAAAccepted cod ...
- PAT_A1113#Integer Set Partition
Source: PAT A1113 Integer Set Partition (25 分) Description: Given a set of N (>) positive integer ...
- PAT1113: Integer Set Partition
1113. Integer Set Partition (25) 时间限制 150 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...
- 1113 Integer Set Partition (25 分)
1113 Integer Set Partition (25 分) Given a set of N (>1) positive integers, you are supposed to pa ...
随机推荐
- JS实现文件自动上传
JS引用: <script type="text/javascript" src="~/bootstrap/js/fileinput.min.js"> ...
- listener中@Autowired无法注入bean的一种解决方法
背景:使用监听器处理业务,需要使用自己的service方法: 错误:使用@Autowired注入service对象,最终得到的为null: 原因:listener.fitter都不是Spring容器管 ...
- Java之路---Day15(Collection类)
2019-11-01-22:09:09 目录 1.Collection集合的概念 2.Collection集合常用方法 3.Iterator迭代器 4.增强for 5.Collection常用工具类 ...
- python爬虫---scrapy框架爬取图片,scrapy手动发送请求,发送post请求,提升爬取效率,请求传参(meta),五大核心组件,中间件
# settings 配置 UA USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, l ...
- Springboot揭秘-快速构建微服务体系-王福强-2016年5月第一次印刷
JavaConfig项目: spring IOC有一个非常核心的概念——Bean.由Spring容器来负责对Bean的实例化,装配和管理.XML是用来描述Bean最为流行的配置方式.Spring可以从 ...
- ASP.NET 后台 COOKIE 的设置
这几年经常与安全打交道,深知 COOKIE 对一个网站的安全影响有多大,所以在编写相与 cookie 相关代码的时候,都会特别的小心. 最近做一个系统,有几个地方用到 cookie, 然后统一把 co ...
- npm err! Unexpected end of JSON input while parsing near解决办法
npm install时出现npm err! Unexpected end of JSON input while parsing near错误 输入 npm cache clean --fore ...
- 关于js保留两位小数方法总结
https://www.cnblogs.com/le220/p/9756881.htmlhttps://blog.csdn.net/hyb1234hi/article/details/84142721 ...
- 【数据库-MySql】开启事件 event_scheduler
Navicat Premium 事件计划已关闭.事件只能在服务器启动并开启事件计划时才能处理. Navicat for MySQL The event_scheduler is Off. Events ...
- Java深入学习(6):Disruptor
Disruptor框架简介: 并发框架,基于事件驱动,使用观察者模式 底层采用环形数组,取模算法 简单使用: /** * 声明一个Event:表示生产者和消费者之间传递的数据类型 */ public ...