| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
感觉没错啊 求大神指点 哪里错了#include<iostream>
using namespace std;
int a[120];
int main()
{
int k=0;
cin>>k;
getchar();
for(int i=0;i<k;i++)
cin>>a[i];
int temp=0;
int point=0;
for(int i=0;i<k-1;i++)
{
point=i;
for(int j=i+1;j<k;j++){
if(a[j]<a[i])
point=j; }
if(point !=i){
temp=a[point];
a[point]=a[i];
a[i]=temp;}
}
int sum=0;
for(int i=0;i<(k+1)/2;i++)
sum+=(a[i]+1)/2;
cout<<sum<<endl;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator