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

呵呵,在自己机器上过了并不能代表在这里能过

Posted by 19861020 at 2006-05-04 23:58:25
In Reply To:哪为高手帮我看一下!在自己的机器上能通过 Posted by:19861102 at 2006-05-04 22:08:54
> #include<iostream>
> #include<string>
> #include<vector>
> #include<algorithm>
> using namespace std;
> typedef struct
>    {string ch;
>      int num;
>    }st;
> vector<st>s;  
> bool sortspecial(st v1,st v2)
> {
>     return v1.num<v2.num;
> }       
> int main()
> {
>     int n,m,i,j,k;
>     cin>>n>>m;
>     s.resize(m);
>     for(i=0;i<m;i++)
>      {
>       cin>>s[i].ch;
>       for(j=0;j<n-1;j++)
>        for(k=j+1;k>=0;k--)
>         {
>            if((s[i].ch)[k]>(s[i].ch)[j])s[i].num++; 
>            
>         }
>      }
>      stable_sort(s.begin(),s.end(),sortspecial);
>      for(i=0;i<m;i++)
>        cout<<s[i].ch<<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