# BZOJ 2301: [HAOI2011]Problem b

## 2301: [HAOI2011]Problem b

Time Limit: 50 Sec  Memory Limit: 256 MB
Submit: 4648  Solved: 2149
[Submit][Status][Discuss]

2
2 5 1 5 1
1 5 1 5 2

14
3

## HINT

100%的数据满足：1≤n≤50000，1≤a≤b≤50000，1≤c≤d≤50000，1≤k≤50000

#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
{
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch<='9'&&ch>='0'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
return f*x;
}
const int N=50100;
int cnt,d,mobius[N],sum[N],prime[N];
bool book[N];
void initial()
{
mobius[1]=1;
for(int i=2;i<=N;i++)
{
if(!book[i]){prime[++cnt]=i;mobius[i]=-1;}
for(int j=1;j<=cnt&&prime[j]*i<=N;j++)
{
book[i*prime[j]]=1;
if(i%prime[j]==0){mobius[i*prime[j]]=0;break;}
else mobius[i*prime[j]]=-mobius[i];
}
}
for(int i=1;i<=N;i++)sum[i]=sum[i-1]+mobius[i];
}
inline int work(int x,int y)
{
if(x>y)swap(x,y);int pos,ans=0;x/=d;y/=d;
for(int i=1;i<=x;i=pos+1)
{
pos=min(x/(x/i),y/(y/i));
ans+=(sum[pos]-sum[i-1])*(x/i)*(y/i);
}
return ans;
}
int main()
{
while(k--)
{
}