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

请大家帮忙看一下怎么会runtime error?谢谢(附源码)

Posted by benny2008 at 2007-11-13 20:25:37 on Problem 2039 and last updated at 2007-11-13 20:26:46
#include<iostream>
#include<string>
using namespace std;
int main()
{
	
	int n,k,w;
	int i,j;
	char p;
	int c=0;
	while(cin>>n&&n!=0)
	{   string x;
		cin>>x;
		k=x.size()/n;
	
		for(i=1;i<=k;i++)
		{
		 if(i%2==0)
		 {for(j=c,w=c+n-1;j<w;j++,w--)
			{        p=x[j];
		             x[j]=x[w];
					 x[w]=p;
			}
		 }
		 c+=n;
		}
     for(j=0;j<n;j++)
		for(i=j;i<x.size();i+=n)
			cout<<x[i];
		
	}
	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