Harmonic Number (II)

TimeLimit: 3000ms  MemoryLimit:32768KB
64-bit integer IO format:%lld
未提交 | 登录后收藏
Problem Description

I was trying to solve problem '1234 - Harmonic Number', I wrote the following code

long long H( int n ) {
    
long long res = 0;
    
for( int i = 1; i <= n; i++ )
        res 
= res + n / i;
    
return res;
}

Yes, my error was that I was using the integer divisions only. However, you are given n, you have to find H(n) as in my code.

Input

Input starts with an integer T (≤ 1000), denoting the number of test cases.

Each case starts with a line containing an integer n (1 ≤ n < 231).

Output

For each case, print the case number and H(n) calculated by the code.

SampleInput
11
1
2
3
4
5
6
7
8
9
10
2147483647
SampleOutput
Case 1: 1
Case 2: 3
Case 3: 5
Case 4: 8
Case 5: 10
Case 6: 14
Case 7: 16
Case 8: 20
Case 9: 23
Case 10: 27
Case 11: 46475828386
Submit
题目统计信息详细
总AC数5
通过人数5
尝试人数6
总提交量12
AC率41.67%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: