比赛 20101118 评测结果 WWATTTTTTT
题目名称 最终得分 10
用户昵称 fanzeyi 运行时间 0.000 s
代码语言 C 内存使用 0.00 MiB
提交时间 2010-11-18 11:00:42
显示代码纯文本
/*
 * ================================================
 *
 * 	Task: Eight
 * 	User: fanzeyi
 * 	Lang: C
 *
 * ================================================
 */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int main()
{
	int n;
	int i,j;
	int *not;
	int *notc;
	int a,b;
	long count=0;
	FILE *fin=fopen("eight.in","r");
	FILE *fout=fopen("eight.out","w");
	fscanf(fin,"%d\n",&n);
	not=(int*)malloc(sizeof(int)*n);
	notc=(int*)malloc(sizeof(int)*n);
	memset(notc,0,sizeof(int)*n);
	for(i=0;i<n;i++)
		fscanf(fin,"%d ",&not[i]);
	fscanf(fin,"%d %d",&a,&b);
	int c=b-a+1;
	count=c/8;
	if(a%8!=0)
		a=(a/8+1)*8;
	for(i=0;i<n;i++)
	{
		for(j=a;j<b;j+=8)
			if(j%not[i]==0)
				notc[i]+=1;
		count-=notc[i];
	}
	fprintf(fout,"%ld",count+1);
	return 0;
}