比赛 |
20101118 |
评测结果 |
AAATTTTTTT |
题目名称 |
八 |
最终得分 |
30 |
用户昵称 |
.Xmz |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2010-11-18 10:17:46 |
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
int x[16],n,a,b;
int gcd(int t1,int t2)
{
if (t1<t2) swap(t1,t2);
if (t2==0) return t1;
return gcd(t2,t1%t2);
}
int dfs(int now,int u,int o,int lim)
{
int re=0;
for (int i=u;i<=n;i++)
{
int t=now*x[i]/gcd(x[i],now);
if (t<=lim)
{
re+=lim/t*o;
re+=dfs(t,i+1,-o,lim);
}
}
return re;
}
int main()
{
freopen("eight.in","r",stdin);
freopen("eight.out","w",stdout);
scanf("%d",&n);
for (int i=1;i<=n;i++)
{
scanf("%d",x+i);
while (x[i]%8!=0) x[i]*=2;
}
scanf("%d%d",&a,&b);
printf("%d",b/8-dfs(1,1,1,b)-((a-1)/8-dfs(1,1,1,a-1)));
return 0;
}