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

为何会RUN TIME ERROR?

Posted by Garra at 2006-03-28 13:20:53 on Problem 1007
#include <iostream>
using namespace std;

struct DNA
{
    char DNA_string[110];
    int sortqual;
};    

DNA _DNA[50];
int n,m;

void work()
{
    int temp,temp_pos;int i,j;
    for(i=0;i<n;i++)
    {
        temp=10000000;
        for(j=0;j<n;j++)
        {
            if (_DNA[j].sortqual<temp)
            {
                temp=_DNA[j].sortqual;
                temp_pos=j;
            }    
        }    
        cout<<_DNA[temp_pos].DNA_string<<endl;
        _DNA[temp_pos].sortqual=10000001;
    }    
    
}    

int main()
{
    while(cin>>m>>n)
    {
        int a,c,t,g;
        int opp_sort;
        for(int i=0;i<n;i++)
        {
            cin>>_DNA[i].DNA_string;
            a=c=t=g=opp_sort=0;
            for(int j=(m-1);j>=0;j--)
            {
                switch(_DNA[i].DNA_string[j])
                {
                    case 'A':a++;break;
                    case 'C':c++;opp_sort+=a;break;
                    case 'G':g++;opp_sort+=(a+c);break;
                    case 'T':t++;opp_sort+=(a+c+g);break;
                }    
            }    
            _DNA[i].sortqual=opp_sort;
        }    
        work();
    }    
    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