比赛 20101116 评测结果 WWWWAWWWWW
题目名称 长路上的灯 最终得分 10
用户昵称 wangwangdog 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2010-11-16 11:24:58
显示代码纯文本
#include<stdio.h>
long j,b;
char a[100];
int i,n,c[51],xiaoshudian,k;
short int flag[2000000];
void gaojingjia()
{
	int oo,y=0;
	for(oo=xiaoshudian;oo>=1;oo--)
	{
		if(oo!=xiaoshudian)c[oo-xiaoshudian+30]=c[oo-xiaoshudian+30]+a[oo]-'0';
		y=c[oo-xiaoshudian+30]/10;
		c[oo-xiaoshudian+30]=c[oo-xiaoshudian+30]%10;
	}
	int tt=0;
	while(y!=0)
	{
	c[30-xiaoshudian-tt]=c[30-xiaoshudian-tt]+y;
	y=c[30-xiaoshudian-tt]/10;
	c[30-xiaoshudian]=c[30-xiaoshudian]%10;
	}
	y=0;
	for(oo=6;oo>=1;oo--)
	{
		c[30+oo]=c[30+oo]+a[oo+xiaoshudian]-'0';
		y=c[30+oo]/10;
		c[30+oo]=c[30+oo]%10;
	}
	if(y!=0)
	{
		tt=1;
		while(y!=0)
		{
			c[30-tt]+=y;
			y=c[30-tt]/10;
			c[30-tt]=c[30-tt]%10;
			tt++;
		}
	}
}
long zhuanhuan()
{
	int oo;
	long pp=0; 
	long long yy=1;
	for(oo=29;oo>=20;oo--)
	{
		pp=c[oo]*yy+pp;
		yy=yy*10;
	}
	return pp;
}
FILE *fin,*fout;
int main()
{
	fin=fopen("light.in","rb");
	fout=fopen("light.out","wb");
	fscanf(fin,"%d\n",&n);
	for(i=1;i<=50;i++)
		a[i]='0';
	for(j=1;j<=20000000;j++)
		flag[i]=0;
	for(i=1;i<=n;i++)
	{
		for(k=1;k<=50;k++)
			c[k]=0;
		
		fscanf(fin,"%c",&a[1]);
		int uu=1;
		while(a[uu]!=' ')
		{
			uu++;
			fscanf(fin,"%c",&a[uu]);
			if(a[uu]=='.')xiaoshudian=uu;
		}
		a[uu]='0';
		uu--;
		fscanf(fin,"%ld",&b);
		fscanf(fin,"\n");
		gaojingjia();
		for(j=1;j<=b;j++)
		{long aaa=zhuanhuan();
			if(flag[aaa]==0)flag[aaa]=1;
			else if(flag[aaa]==1)flag[aaa]=0;
			gaojingjia();
		}
	}
	long fl;
	for(j=1;j<=20000000;j++)
	{
		if(flag[j]==1){fl=j;break;}
	}
	fprintf(fout,"%ld",fl);
	fclose(fin);
	fclose(fout);
	return 0;
}