예제 #1
0
파일: Test1.c 프로젝트: ymfnudt/helloworld
int main()
{
	int n;
	scanf("%d",&n);
	if(n<1 || n>1000)
	{
		scanf("%d",&n);
	}
	int s[n],i;
	for(i=0;i<n;i++)
	{
		scanf("%d",&s[i]);
		if(s[i]<1 || s[i]>10000)
		{
			scanf("%d",&s[i]);
		}	
	}
	BubbleSort(s,n);
	int j,count[n];
	for(i=0;i<n;i++)
	{
		count[i] = 1;
	}
	int flag=0;
	for(i=0;i<n-1;)
	{
		for(j=n-1;j>i;)
		{
			if(s[i] == s[j])
			{
				count[i] = j-i+1; 
				flag = 1;
				i = j+1;
				break;
			}
			else 
				j--;
		}
		if(flag == 1)
			i = j+1;
		else
			i++;
	}
	int k;
	k= GetMaxI(count,n);
	printf("%d",s[k]); 
	return 0;
}
예제 #2
0
// return the lowest culled peak and the highest culled peak less than the
// +1 precursor mass
void CMSPeak::HighLow(int& High, int& Low, int& NumPeaks, const int PrecursorMass,
		      const int Charge, const double Threshold, int& NumLo, int& NumHi)
{
    EMSPeakListTypes Which = GetWhich(Charge);

    SetPeakLists()[Which]->Sort(eMSPeakListSortMZ);
    
    if(GetPeakLists()[Which]->GetNum() < 2) {
	High = Low = -1;
	NumPeaks = NumLo = NumHi = 0;
	return;
    }

    Low = PrecursorMass;
    High = 0;
    NumPeaks = 0;
    NumLo = 0;
    NumHi = 0;

    int MaxI = GetMaxI(Which);

    int iMZI;
    for(iMZI = 0; iMZI < GetPeakLists()[Which]->GetNum(); iMZI++) {
	if(GetPeakLists()[Which]->GetMZI()[iMZI].GetIntensity() > Threshold*MaxI &&
	   GetPeakLists()[Which]->GetMZI()[iMZI].GetMZ() <= PrecursorMass) {
	    if(GetPeakLists()[Which]->GetMZI()[iMZI].GetMZ() > High) {
		High = GetPeakLists()[Which]->GetMZI()[iMZI].GetMZ();
	    }
	    if(GetPeakLists()[Which]->GetMZI()[iMZI].GetMZ() < Low) {
		Low = GetPeakLists()[Which]->GetMZI()[iMZI].GetMZ();
	    }
	    NumPeaks++;
	    if(GetPeakLists()[Which]->GetMZI()[iMZI].GetMZ() < PrecursorMass/2.0) NumLo++;
	    else NumHi++;
	}
    }
}