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 ...
随机推荐
- 象棋中“车”的攻击范围_C#
如题: var a = new String[8,8]; int h, l; Console.WriteLine("输入车所在的行(0-7):"); h = int.Parse(C ...
- Spring Web MVC框架简介
Web MVC framework框架 Spring Web MVC框架简介 Spring MVC的核心是`DispatcherServlet`,该类作用非常多,分发请求处理,配置处理器映射,处理视图 ...
- C#控制IIS动态添加删除网站
我的目的是在Winform程序里面,可以直接启动一个HTTP服务端,给下游客户连接使用. 查找相关技术,有两种方法: 1.使用C#动态添加网站应用到IIS中,借用IIS的管理能力来提供HTTP接口.本 ...
- 【SQL】各取所需 | SQL JOIN连接查询各种用法总结
前面 在实际应用中,大多的查询都是需要多表连接查询的,但很多初学SQL的小伙伴总对各种JOIN有些迷糊.回想一下,初期很长一段时间,我常用的似乎也就是等值连接 WHERE 后面加等号,对各种JOIN也 ...
- 浅谈Object.prototype.toString.call()方法
在JavaScript里使用typeof判断数据类型,只能区分基本类型,即:number.string.undefined.boolean.object.对于null.array.function.o ...
- Springboot2 jpa druid多数据源
package com.ruoyi; import org.mybatis.spring.annotation.MapperScan; import org.springframework.beans ...
- setsockopt()函数使用
closesocket(一般不会立即关闭而经历TIME_WAIT的过程)后想继续重用该socket BOOL bReuseaddr=TRUE; setsockopt (s,SOL_SOCKET ,SO ...
- k8s的常用命令(一)
常用的kubectl命令 kubectl run kubia --image=luksa/kubia --port=8080 --generator=run/v1 --image 指定镜像 - ...
- nmap使用流程
ip为案列 利用ipconfig 测得本地ip为 192.00.00.100 利用-sn探测一批主机内的存活主机 存活主机ip为 192.000.00.1 192.000.00.100 使 ...
- JS实现俄罗斯方块
在80后.90后的儿时记忆里,俄罗斯方块是必备的消遣小游戏,它的玩法非常简单基本大家都懂,但如何用编程语言开发一款儿时同款「俄罗斯方块」,恐怕知道的同学就很少啦. 位置掩码和旋转掩码 俄罗斯方块游戏中 ...