UVA 11136 - Hoax or what (可以提交了,不会Submission error了)
来源:互联网 发布:windows 7主题 编辑:程序博客网 时间:2024/06/05 19:06
看题传送门:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2077
这题交上去以前一直Submission error 。拿别人的AC代码也一样。
现在可以提交了~原来的代码就是对的^ ^ (2013/10/23)
用到了multiset ,不是set哦,set不允许元素重复,而multiset 允许。
#include<cstdio>#include<set>#include<algorithm>using namespace std;int main(){multiset<int> p;int n;while(scanf("%d",&n),n){long long ans=0;p.clear();//清空for(int ri=0;ri<n;ri++){int k;scanf("%d",&k);for(int i=0;i<k;i++){int temp;scanf("%d",&temp);p.insert(temp);}multiset<int>::iterator minp,maxp; minp=p.begin();maxp=p.end(); //尾部迭代器只是哨兵maxp--;ans=ans+ *maxp- *minp;p.erase(minp);p.erase(maxp);}printf("%lld\n",ans);}}
- UVA 11136 - Hoax or what (可以提交了,不会Submission error了)
- uva Hoax or what 11136(multiset)
- UVA - 11136Hoax or what(set)
- UVa 11136 - Hoax or what(可重集)
- UVA 11136 Hoax or what(Multiset)
- Uva-11136-Hoax or what
- uva 11136 Hoax or what
- uva 11136 Hoax or what
- UVA - 11136 Hoax or what
- UVa:11136 Hoax or what
- UVA 11136 Hoax or what
- UVa 11136 - Hoax or what
- UVA - 11136 Hoax or what
- UVa 11136 - Hoax or what
- UVA - 11136 Hoax or what
- uva 11136 Hoax or what
- UVA 11136 Hoax or what (multiset)
- UVA 11136 - Hoax or what(set模拟)
- 20130805
- <Error>: ImageIO: PNG invalid PNG file: iDOT doesn't point to valid IDAT chunk 解决
- POJ 1056 字典树
- Oracle免客户端安装(一)
- PHP数组基础
- UVA 11136 - Hoax or what (可以提交了,不会Submission error了)
- JVM学习笔记(四)------内存调优
- 深入理解C语言
- 有JSON中字段最好是【字符】而非【enum】想到
- 排序算法c语言描述---选择排序
- PHP表单GET
- poj2524
- linux进程间的同步方法
- PHP表单POST