|
|
back to boardwhat is my problem??? Posted by ws 11 Aug 2006 13:52 #include<iostream> using namespace std; int main() { int a; cin>>a; while(a<=0) cin>>a; while(a>20) cin>>a; int group[20]; for(int a1=0;a1<a;a1++) { cin>>group[a1]; } for(int a2=0;a2<a-1;a2++) {
for(int a3=a2+1;a3<a;a3++) { int c=group[a2]; if(group[a2]<=group[a3]) group[a2]=group[a3],group[a3]=c; } } if(a==1) cout<<group[0]<<endl; if(a==2) cout<<group[0]-group[1]<<endl; int sum=0; for(int d=0;d<a;d++) { if(sum<=group[d]) sum=group[d]-sum; else sum=sum-group[d]; } cout<<sum<<endl; return 0; }
Re: what is my problem??? Posted by ws 23 Aug 2006 19:15 5 6 18 18 19 23 0 |
|
|