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

无语

Posted by 00448264 at 2005-07-09 00:13:39 on Problem 2371
In Reply To:Re:敢情你的计算概论和程序实习全逃课了?char c[3]算什么东西?后面的'\0'装哪儿去? Posted by:00 at 2005-07-09 00:09:03
#include<iostream.h>
#include<stdlib.h>
int compare(const void *arg1,const void *arg2);
void main()
{
	long N,i;
	cin>>N;
	int *d=new int[N];
	for(i=0;i<N;i++)
		cin>>d[i];
	qsort(d,N,sizeof(int),compare);
	char c[4];
	cin>>c;
	int K,q;
	cin>>K;
	for(i=0;i<K;i++)
	{
		cin>>q;
		cout<<d[q-1]<<endl;
	}
	delete [] d;
}
int compare(const void *arg1,const void *arg2)
{
	return ((int *)arg1)[0]-((int*)arg2)[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