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

3617一直WA

Posted by Difei at 2014-05-05 22:39:14
在本地上用vs测试一些小数据都是对的(应该是个小错误但是一直没找到):

/** poj 3617 best cow line一直WA
* 05.05/2014
*/
#include <stdio.h>
#include <string.h>

#define MAXN 4000
#define INF 100000000


int N;
char ca[MAXN];


void solve()
{	
	int starti = 0,endi = N-1;
	int count = 0;
	while (starti <= endi)
	{	
		for(int i =0; starti + i <= endi; i++)
		{
			if(ca[starti + i] <= ca[endi-i])
			{
				putchar(ca[starti ++]);count++;
				break;
			}
			else
			{
				putchar(ca[endi --]);count++;
				break;
				
			}

		}
		if(count == 80)
		{
			putchar('\n');
			count =0;
		}
	}
	putchar('\n');
	return;
}
int main()
{	
	scanf("%d",&N);
	//scanf("%s",ca);
	for(int i = 0; i < N; i++)
		scanf("\n%c",&ca[i]);
	solve();

	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