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

题目很简单,但就是WA,死活找不到错误,各位帮帮忙

Posted by 771385494 at 2011-10-22 20:30:39 on Problem 2039
#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:
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