Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
怎么一直wa,求教!!!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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator