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 yaonajiang at 2017-03-24 18:04:18 on Problem 3617
In Reply To:求教为什么不能过啊 Posted by:qq1726542850 at 2016-06-10 19:36:07
> #include <cstdio>
> #include <string>
> #include <cstdlib>
> #include <cstring>
> #include <iostream>
> #include <algorithm>
> 
> using namespace std;
> char cows[2300]={0};
> 
> int main(){
>     int n;
>     cin >> n;
>     for(int i = 0; i < n; ++i)
>     {
>       cin >> cows[i];
>     }
>     int first = 0, last = n - 1;
>       for(int i = 1; i <= n && first <= last; ++i)
>         {
>             if(cows[first] > cows[last])
>                 cout << cows[last--];
>             else if(cows[first] < cows[last])
>                 cout << cows[first++];
>             else {
>                 int kiss = 0;
>                 for(int j = 0; first+j <= last; ++j)
>                 {
>                     if(cows[first+j] < cows[last-j])
>                     {kiss = 1; break;}
>                     else if(cows[j] > cows[last-j])
>                     {kiss = 0; break;}
>                 }
>                 if(kiss)
>                     cout << cows[first++];
>                 else cout << cows[last--];
>             }
>             if(i % 80 == 0) cout << endl;
>         }
>         if(n % 80) cout << endl;
> }

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