现在的位置: 首页 > 综合 > 正文

[RQNOJ]212提示问题

2013年10月11日 ⁄ 综合 ⁄ 共 1382字 ⁄ 字号 评论关闭

 

http://www.rqnoj.cn/Problem_212.html

#include "stdio.h"
void main()
{
	char str[51];
	gets(str);
	int i=0,n=0,t=1,k;
	float f;
	while(str[i])
	{
		if((str[i]>=65&&str[i]<=90)||(str[i]>=97&&str[i]<=122))
		{
			printf(".");
			n++;
		}

		else
			printf("%c",str[i]);
		i++;
	}
	printf("/n");

	//1111结á束?


	f=(float)n/3.0;
	if(f-(int)f>=0.5)
		f+=1;


	for (t=1,i=0;t<=(int)f;i++)
	{
		printf("%c",str[i]);  
		if((str[i]>=65&&str[i]<=90)||(str[i]>=97&&str[i]<=122))
			t++;
	}
	k=i;

	for(;str[i];i++)
		if((str[i]>=65&&str[i]<=90)||(str[i]>=97&&str[i]<=122))
			printf(".");
		else
			printf("%c",str[i]);
	printf("/n");


	//////////2222222222
	t=0;
	for (i=k;str[i];i++)
	{
		if(str[i]=='a'||str[i]=='A'||str[i]=='e'||str[i]=='E'||str[i]=='I'||str[i]=='i'||str[i]=='o'||str[i]=='O'||str[i]=='u'||str[i]=='U')
			t++;
	}

	if (!t)
	{
		f=(float)n*2/3.0;
		if(f-(int)f>0.5)
			f++;
		f--;
		t=0;
		for (i=0;t<=(int)f;i++)
		{
			printf("%c",str[i]);
			if((str[i]>=65&&str[i]<=90)||(str[i]>=97&&str[i]<=122))
				t++;
		}

		for(;str[i];i++)
			if((str[i]>=65&&str[i]<=90)||(str[i]>=97&&str[i]<=122))
				printf(".");
			else
				printf("%c",str[i]);

	}
	else
	{
		f=(float)n/3.0;
		if(f-(int)f>=0.5)
			f+=1;

		for (t=1,i=0;t<=(int)f;i++)
		{  
			printf("%c",str[i]);
			if((str[i]>=65&&str[i]<=90)||(str[i]>=97&&str[i]<=122))
				t++;
		}
		for (;str[i];i++)
		{
			if(str[i]=='a'||str[i]=='A'||str[i]=='e'||str[i]=='E'||str[i]=='I'||str[i]=='i'||str[i]=='o'||str[i]=='O'||str[i]=='u'||str[i]=='U'||!((str[i]>=65&&str[i]<=90)||(str[i]>=97&&str[i]<=122)))
			{
				printf("%c",str[i]);
			}
			else
				printf(".");
		}
	}
	printf("/n");
}

 

 

//教训:要仔细读题

抱歉!评论已关闭.