1113. Integer Set Partition (25)
来源:互联网 发布:水中刀 知乎 编辑:程序博客网 时间:2024/05/16 02:08
题目见这里
一个一看就会的题目
代码如下:
#include <stdio.h>#include <stdlib.h> #define N 100005 int Cmp(const void *a, const void *b){ return *(int *)b - *(int *)a;}int main(){// freopen("Data.txt","r",stdin); int set[N]; int n,i,difference; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&set[i]); qsort(set,n,sizeof(set[0]),Cmp); difference = 0; for(i=0;i<n;i++){ if(i<(n+1)/2) difference += set[i]; else difference -= set[i]; } printf("%d %d\n",n%2,difference); return 0;}
阅读全文
1 0
- 1113. Integer Set Partition (25)
- 1113. Integer Set Partition (25)
- 1113. Integer Set Partition (25)
- 1113. Integer Set Partition (25)
- 1113. Integer Set Partition (25)
- 1113. Integer Set Partition (25)
- 1113. Integer Set Partition (25)
- 1113. Integer Set Partition (25)
- 1113. Integer Set Partition (25)
- 1113. Integer Set Partition (25)
- 1113. Integer Set Partition (25)
- 1113. Integer Set Partition
- 1113. Integer Set Partition
- PAT_A 1113. Integer Set Partition (25)
- pat 1113. Integer Set Partition (25)
- 1113. Integer Set Partition (25) PAT 甲级
- PAT 甲级 1113. Integer Set Partition (25)
- PAT--1113. Integer Set Partition
- 前端事件绑定知识点(面试常考)
- 【归纳】关于字符编码、全角/半角、字节、字符、字长等的理解(未完待续)
- 优先队列优化Dijkstra-hdu2066
- 51nod 1163 最高的奖励
- Android 实现通过url加载PDF
- 1113. Integer Set Partition (25)
- 【理论实践】实例体会一下using声明会屏蔽外层作用域的同名实体
- HDU 1599[find the mincost route]题解
- 2017 java面试题总览
- Systemstate Dump分析经典案例(下)
- 基于OnPaint的Slider进度条自绘实现
- windows命令行下的常见命令
- C++:标准模板库map
- 最牛语义匹配算法_速围观!