Responsive image

问题 1888 --Senior PanⅡ

1888: Senior PanⅡ

时间限制: 4 Sec  内存限制: 1280 MB
提交: 1  解决: 1
[提交][状态][讨论版][命题人:]

题目描述


Senior Pan had just failed in his math exam, and he can only prepare to make up for it. So he began a daily task with Master Dong, Dong will give a simple math problem to poor Pan everyday.
But it is still sometimes too hard for Senior Pan, so he has to ask you for help.
Dong will give Pan three integers L,R,K every time, consider all the positive integers in the interval [L,R], you’re required to calculate the sum of such integers in the interval that their smallest divisor (other than 1) is K.

输入描述

The first line contains one integer T, represents the number of Test Cases.
Then T lines, each contains three integers L,R,K(1≤L≤R≤10^11,2≤K≤10^11)
 

输出描述

For every Test Case, output one integer: the answer mod 10^9+7
 

样例输入

2
1 20 5
2 6 3

样例输出

Case #1: 5
Case #2: 3

来源

 

[提交][状态]
ACM算法攻关部
  • Anything about this OnlineJudge, Please Contact Administrator. Click add QQ

    OJ system based on HUSTOJ Project , UI based on Twitter Bootstrap

    Copyright 2016 ACM算法攻关部
    关于网站改版