欢迎加入西电微软俱乐部招新群 588166170,做出福利题,免技术部第一次面试且赠送“福利”海报或小礼品~~~~
Xidian Online Judge WebBoard
[ New Thread ]
Problem 1036 >> 无耻的求hack数据
windroid @ 2015-05-27 10:31:52
[ Quote ] [ Edit ] [ Delete ] 1#
#include<iostream>
#include<algorithm>
using namespace std;
int d[205];
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
for(int i=0; i<n; i++){
cin>>d[i];
}
int ans = 0;
sort(d, d+n);
while(--n>=0){
if(ans>d[n]){
ans -= d[n];
}else{
ans = d[n]-ans;
}
}
cout<<ans<<endl;
}
return 0;
}
04113133 @ 2015-06-01 15:49:03
[ Quote ] [ Edit ] [ Delete ] 2#
刚过了1036 数据貌似没问题
[Top] [Previous Page] [Next Page]
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2014 Xidian ACM Online Judge TEAM
GPL2.0 2003-2014 HUSTOJ Project TEAM