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

没事分享一下AC代码,容易PE的题目

Posted by cailizhong at 2010-07-31 01:50:00 on Problem 2271
//下面是已经AC的代码
#include <stdio.h>
#include <string.h>
int main()
{
	char a[81];
	int l;
	int s = 0;
	int first = 0;
	while (scanf("%s",&a)==1)
	{
		l = strlen(a);
		if (strcmp(a,"<br>") == 0)
		{
			printf("\n");
			s = 0; first = 0;
		}
		else if (strcmp(a,"<hr>") == 0)
		{
			if (s != 0) printf("\n");
			printf("--------------------------------------------------------------------------------\n");
			s = 0; first = 0;
		}
		else if (s + l + 1> 80) {printf("\n%s",a); s=l; first = 1;}
		else
		{
			if (first) printf(" ");
			printf("%s",a);
			first = 1; s += l + 1;
		}
	}
	printf("\n");
	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