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

why is my answer wrong???

Posted by samuel_mwambazi at 2014-03-12 21:34:41 on Problem 3781
#include <iostream>
#include <cstdio>
using namespace std;
#define N 10

int main()
{
    int t,i=0,s=0,n;
    int x;


    int a[N];

    cin>>n;
    while(s<n){
        cin>>x;
    for(i=0;i<N;i++){

               cin>>a[i];
        for(int j=i+1;j<N;j++){
            if(a[i]>a[j]){
                t=a[i];
                a[i]=a[j];
                a[j]=t;
            }
        }
    }
    s++;
    cout<<x<<" "<<a[N-3]<<endl;
    }
}

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