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

怎么一直wa,求教!!!

Posted by Mandy0424 at 2023-01-18 13:11:01 on Problem 3617
In Reply To:笨方法,但能想到的数据都过过了,怎么一直wa,求教!!!!! Posted by:xulinxi at 2010-08-17 11:50:19
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<string.h>
using namespace std;
int n;
string s;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		char c;
		cin>>c;
		s.push_back(c);
	}
	int l=0,r=n-1,sum=0;
	while(l<=r)
	{
	    string v=s.substr(l,r-l+1);
		string t=s;
		reverse(t.begin(),t.end());
		if(s<t)
		  cout<<s[l++];
		else
		  cout<<s[r--];
		sum++;
		if(sum%80==0)
		  cout<<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