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,死活找不到错误,各位帮帮忙#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