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 ...
随机推荐
- UDP比TCP好用的优势
网络带宽环境变好 在2007年至2015年间,网络的带宽飞速发展,从1.5Mbps的带宽增加到5.1Mbps的带宽,足足增加了4倍,网络环境快速.稳定,所以UDP的丢包率 下降至5%以下,越来越好的网 ...
- 引入 ServletContextListener @Autowired null 解决办法
public class ScheduleController implements ServletContextListener { @Autowired private ScheduleServi ...
- Mysql获取字符串中的数字函数方法和调用
)) ) BEGIN ; ) default ''; set v_length=CHAR_LENGTH(Varstring); DO )) )) ) THEN )); END IF; ; END WH ...
- bootstrap-switch使用,small、mini设置
1.首先需要引用https://www.bootcss.com/p/bootstrap-switch/. bootstrap-switch插件库 2.先引用jquery文件,在引用bootstrap. ...
- C#读写设置修改调整UVC摄像头画面-增益
有时,我们需要在C#代码中对摄像头的增益进行读和写,并立即生效.如何实现呢? 建立基于SharpCamera的项目 首先,请根据之前的一篇博文 点击这里 中的说明,建立基于SharpCamera的摄像 ...
- Shadowmap简易实现
之前一直没有自己实现过阴影,只是概念上有所了解,这次通过Demo进行实际编写操作. 总的来说没有什么可以优化的,倒是对于窗户这种可用面片代替的物体似乎能优化到贴图上,之前arm有个象棋屋的demo做过 ...
- JavaScript 之 Math对象
Math对象 Math 对象不是构造函数,它具有数学常数和函数的属性和方法,都是以静态成员的方式提供. 常用方法: Math.PI // 圆周率 Math.random() // 生成随机数,生成0~ ...
- linux下执行python 提示module找不到 要加入系统路劲才找得到
linux/cmd中python路径导入ModuleNotFoundError: No module named 'xxx' import osimport syscurPath = os.pat ...
- windows自动化-脚本案例
; Script Start - Add your code below here Run("D:\Navicat Premium\navicat.exe") Sleep(1000 ...
- python3.5如何安装statsmodels包?
如题: 系统win10,64 python3.5 32 使用pip install statsmodels 会报错,说cpython没有安装.一直找不到解决办法,就只好去第三方库下载了一个 http: ...