Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我去,题目意思尚且不是很明白,看数据样例猜了一下居然一次就AC,太水了这题

Posted by 201501060326 at 2016-03-12 23:10:44 on Problem 2388
#include <iostream>
using namespace std;
int array[10000000];
int main()
{
    int k,i,j,min,t;
    cin>>k;
    for(i=1; i<=k; i++)
        cin>>array[i];
    for(i=1; i<=k-1; i++)
    {
        min=i;
        for(j=i+1; j<=k; j++)
        {
            if(array[j]<array[min])
                min=j;
        }
        if(min!=i)
        {
            t=array[i];
            array[i]=array[min];
            array[min]=t;
        }
    }
    cout<<array[(k+1)/2]<<endl;
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator