| ||||||||||
| 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 | |||||||||
请大家帮忙看一下怎么会runtime error?谢谢(附源码)#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator