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:为什么错求解释

Posted by gaoguoji at 2014-02-28 00:48:16 on Problem 1007
In Reply To:为什么错求解释 Posted by:guangmingge at 2012-10-19 00:03:20
> #include<iostream>
> #include<string>
> 
> using namespace std;
> 
> struct Index{
>        int a;
>        string str;
> };
> 
> int Inorder(string,int);
> 
> int main(){
> 
>     int first,second;
>     cin>>first>>second;
> 
>     Index DNA[second];
>     Index temp;
>     int find[second];
> 
>     for(int i=0;i<second;i++){
>             cin>>DNA[i].str;
>     }
> 
>     for(int i=0;i<second;i++){
>              DNA[i].a = Inorder(DNA[i].str,first);
>     }
>     for(int i=0;i<second;i++){
>             for(int j=i+1;j<second;j++){
>                     if(DNA[i].a>DNA[j].a){
>                              temp = DNA[i];
>                              DNA[i] = DNA[j];
>                              DNA[j] = temp;
>                     }
>             }
>     }
>     for(int i=0;i<second;i++){
>              cout<<DNA[i].str<<endl;
>     }
> 
>     cin>>first;
>     system("pause");
>     return 0;
> }
> 
> int Inorder(string str,int le){
>                    int count;
>                    count = 0;
>                    for(int p=0;p<le;p++){
>                          for(int q=p+1;q<le;q++){
>                                  if(str[p]>str[q])
>                                      count++;
>                          }
>                    }
>                    return count;
> }

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