// // main.cpp // ProCon // // Created by hashimotoryoma on 2017/08/20. // Copyright © 2017年 hashimotoryoma. All rights reserved. // #include #include #include using namespace std; typedef long long ll; int N; ll L, H; ll C[11]; ll ans; ll gcd(ll x,ll y){ return y==0? x:gcd(y,x%y); } ll lcm(ll x,ll y){ return x*y/gcd(x,y); } ll lcmC[1<<11]; ll solve(int d,int num,int s){ int e = num&1? 1:-1; if(d == N) return e*num*(H/lcmC[s]-(L-1)/lcmC[s]); ll res=0; res += solve(d+1,num,s); res += solve(d+1,num+1,s|(1<> N >> L >> H; for(int i=0;i> C[i]; } int total = 1 << N; lcmC[0] = 1; for(int s = 0;s < total;s++){ for(int u=0;u