F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

TrickGCD

Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 5343    Accepted Submission(s): 1868


Problem Description
You are given an array $A$ , and Zhu wants to know there are how many different array $B$ satisfy the following conditions?

* $1\leq B_{i} \leq A_{i}$
* For each pair( l , r ) ($1 \leq l \leq r \leq n$) , $gcd( b_{l} , b_{l+1} ... b_{r} )\ge 2$
 

Input
The first line is an integer T($1 \leq T \leq 10$) describe the number of test cases.

Each test case begins with an integer number n describe the size of array $A$.

Then a line contains $n$ numbers describe each element of $A$

You can assume that $1 \leq n , A_{i} \leq 10^5$
 

Output
For the $k$th test case , first output "Case #k: " , then output an integer as answer in a single line . because the answer may be large , so you are only need to output answer $mod$ $10^9+7$
 

Sample Input
1 4 4 4 4 4
 

Sample Output
Case #1: 17
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-20 01:10:33, Gzip enabled