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

Re:一直runtime error 什么情况 求帮助

Posted by njuallen at 2015-02-08 23:00:56 on Problem 1007
In Reply To:一直runtime error 什么情况 求帮助 Posted by:ghsshou at 2015-01-22 18:18:35
> #include <iostream>
> #include <string>
> #include <stdlib.h>
> #define NUM 15
> #define LENGTH 10
>     using namespace std;
> 	struct DNA
> 	{
> 		char str[LENGTH];
> 		int measure;
> 	};
> 	int cmp(const void *a,const void *b)
> 	{
> 		return((*(struct DNA *)a).measure-(*(struct DNA *)b).measure>0)?1:-1;
> 	}
> 
>     int main()
>     {
> 		struct DNA dna[NUM];
>         int n,m;
> //		char *ptr;
>         cin>>n>>m;
>         for(int i=0;i<m;i++)
> 		{
> 			cin>>dna[i].str;
> 			dna[i].measure=0;
> //			ptr=(char *)dna[i].str;
>             for(int j=0;j<n-1;j++)
>             {
>                 for(int ii=j+1;ii<n;ii++)
> 					if(dna[i].str[j]=='A')
> 						break;
> 					else
> 						if(dna[i].str[j]>dna[i].str[ii])
> 							dna[i].measure++;
> //                ptr++;
>             }
>         }
> 		qsort(dna,m,sizeof(DNA),cmp);
> 		for(int i=0;i<m;i++)
> 			cout<<dna[i].str<<endl;   
>         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