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

怎么会内存占用太多?

Posted by YangJian at 2003-12-07 11:04:51 on Problem 1566
我木有用什么申请内存的语句啊,所有的内存占用都是可以控制的啊
sigh……

#include <stdio.h>

void main()
{
	char Temp[210] , ch , Template[6] = "e/o/i" ;
	int i , Num , Begin ;

	while(1)
	{
		scanf( "%c" , &ch ) ;
		i = 0 ;

		while ( ch != '\n' && ch != EOF )
		{
			Temp[i++] = ch ;
			scanf( "%c" , &ch ) ;
		}

		if ( ch == EOF )
			break ;

		Temp[i] = 0 ;	

		for ( i = 0 ; i < 5 ; i ++ )
			if ( Template[i] != Temp[i] )
				break ;

		if ( i == 5 )
			break ;

		Num = 0 ;
	
		Begin = Num ;

		for ( i = 0 ; Temp[i] != '/' ; i ++ )
		{
			
			if ( (Temp[i] == 'a') || (Temp[i] == 'e') ||  (Temp[i] == 'i') || (Temp[i] == 'o') ||(Temp[i] == 'u' ) || (Temp[i] == 'y' ) )
			{
				if ( (Temp[i+1] == 'a') || (Temp[i+1] == 'e') ||  (Temp[i+1] == 'i') || (Temp[i+1] == 'o') ||(Temp[i+1] == 'u' ) || (Temp[i+1] == 'y' ) )
					Num -- ;
				Num ++ ;
			}

			if ( Temp[i] == ' ' )
			{
				if ( Num == Begin )
					Num ++ ;
				Begin = Num ;
			}
		}

		if ( Num != 5 )
		{
			printf("1\n" ) ;
			goto loop ;
		}

		Num = 0 ;
		
		Begin = Num ;

		for ( i ++ ; Temp[i] != '/' ; i ++ )
		{
			
			if ( (Temp[i] == 'a') || (Temp[i] == 'e') ||  (Temp[i] == 'i') || (Temp[i] == 'o') ||(Temp[i] == 'u' ) || (Temp[i] == 'y' ))
			{
				if ( (Temp[i+1] == 'a') || (Temp[i+1] == 'e') ||  (Temp[i+1] == 'i') || (Temp[i+1] == 'o') ||(Temp[i+1] == 'u' ) || (Temp[i+1] == 'y' ) )
					Num -- ;
				Num ++ ;
			}

			if ( Temp[i] == ' ' )
			{
				if ( Num == Begin )
					Num ++ ;
				Begin = Num ;
			}
		}

		if ( Num != 7 )
		{
			printf("2\n" ) ;
			goto loop ;
		}

		Num = 0 ;
		
		Begin = Num ;

		for ( i ++ ; Temp[i] != 0 ; i ++ )
		{
			
			if ( (Temp[i] == 'a') || (Temp[i] == 'e') ||  (Temp[i] == 'i') || (Temp[i] == 'o') ||(Temp[i] == 'u' ) || (Temp[i] == 'y' ))
			{
				if ( (Temp[i+1] == 'a') || (Temp[i+1] == 'e') ||  (Temp[i+1] == 'i') || (Temp[i+1] == 'o') ||(Temp[i+1] == 'u' ) || (Temp[i+1] == 'y' ) )
					Num -- ;
				Num ++ ;
			}

			if ( Temp[i] == ' ' )
			{
				if ( Num == Begin )
					Num ++ ;
				Begin = Num ;
			}
		}

		if ( Num != 5 )
		{
			printf("3\n" ) ;
			goto loop ;
		}

		printf("Y\n" ) ;
loop: ;
	}

}

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