#BZOJ2301. [HAOI2011]Problem b
[HAOI2011]Problem b
题目描述
<![endif]--><!--[if !mso]>
st1:*{behavior:url(#ieooui) }
<![endif]--><!--[if gte mso 10]>
/* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}
<![endif]--> 对于给出的n个询问,每次求有多少个数对(x,y),满足a≤x≤b,c≤y≤d,且gcd(x,y) = k,gcd(x,y)函数为x和y的最大公约数。
输入格式
第一行一个整数n,接下来n行每行五个整数,分别表示a、b、c、d、k
输出格式
共n行,每行一个整数表示满足要求的数对(x,y)的个数
2
2 5 1 5 1
1 5 1 5 2
14
3
f提示
100%的数据满足:1≤n≤50000,1≤a≤b≤50000,1≤c≤d≤50000,1≤k≤50000