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 |
Re:题目很简单,但就是WA,死活找不到错误,各位帮帮忙In Reply To:题目很简单,但就是WA,死活找不到错误,各位帮帮忙 Posted by:771385494 at 2011-10-22 20:30:39 > #include <iostream> > #include <cstring> > using namespace std; > int main() > { > int n,i,j; > char message[201],ch; > while(cin >> n && n != 0){ > cin >> message; > int length = strlen(message); > for(i = n;i < length;i += n * 2) > for(j = i;j < (n * 1.0 / 2 + i);j++){ > ch = message[j]; > message[j] = message[2 * i - 1 + n - j]; > message[2 * i - 1 + n - j] = ch; > } > j= 1; > for(i = 0;i <= 201;i += n){ > if(i >= length) > i = j++; > cout << message[i]; > if(i == length - 1) > break; > } > 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