| ||||||||||
| 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.h>
#include<stdio.h>
void QuickSort(int x[],int low,int high);
void QuickSort(int x[],int low,int high)
{
int i,j;
int Temp;
i=low;
j=high;
Temp=x[low];
while(i<j)
{
while(i<j&&Temp<=x[j])
j--;
if(i<j)
{
x[i]=x[j];
i++;
}
while(i<j&&x[j]<=Temp)
i++;
if(i<j)
{
x[j]=x[i];
j--;
}
}
x[i]=Temp;
if(low<i-1)QuickSort(x,low,i-1);
if(j+1<high)QuickSort(x,j+1,high);
}
void main()
{
int a[100][100];
int i,j,k,n;
j=0;
do{
i=0;
while(i<101)
{
cin>>a[j][i];
if(a[j][i]<=0||a[j][i]==-1) break;
else i++;
}
if(i)
QuickSort(a[j],0,i-1);
if(a[j][0]!=-1)
j++;
else break;
}while(1);
for(k=0;a[k][0]!=-1;k++)
{
n=i=0;
while(a[k][i])
{
for(j=i+1;a[k][j]!=0;j++)
{
if(2*a[k][i]==a[k][j])
{
n++;
break;
}
}
i++;
}
cout<<n<<endl;
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator