Difference between revisions of "Solução: Problema da competição alien (Tito Filho)"

From AdonaiMedrado.Pro.Br
Jump to: navigation, search
(New page: <code lang="c"> #include <stdio.h> #include <string.h> int main (void) { char frase[250]; int i,N,x,soma; scanf("%d",&N); if (N>=1 && N<=10) { scanf("%s", frase); ...)
 
 
Line 5: Line 5:
 
int main (void)
 
int main (void)
 
{
 
{
   char frase[250];
+
   char frase[251];
 
   int i,N,x,soma;
 
   int i,N,x,soma;
 
   scanf("%d",&N);
 
   scanf("%d",&N);

Latest revision as of 18:01, 3 April 2009

#include <stdio.h>
#include <string.h>
 
int main (void)
{
   char frase[251];
   int i,N,x,soma;
   scanf("%d",&N);
   if (N>=1 && N<=10)
   {	
     	scanf("%s", frase);
     	i=0; soma=0;
     	while (frase[i]!='\0')
     	{
     		x=0;
  		while(frase[i]>='a' && frase[i]<='z')
  		{
  			x++;
  			i++;
		}
  		i++;  				
		if (x==N)
			++soma;
	}		
     	printf("%d",soma);
    }
}