- #include <bits/stdc++.h>
- using namespace std;
- #define llu long long unsigned
- int main(){
- int ts;
- scanf("%d", &ts);
- for(int p = 1; p <= ts; p++){
- int n;
- scanf("%d", &n);
- llu sum = 0;
- int m = sqrt(n);
- for(int i = 1; i<= m; i++) sum += (n/i);
- for(int i = 1; i<= m; i++){
- sum+= ((n/i)-(n/(i+1)))*i;
- }
- if(m==n/m) sum -= m;
- printf("Case %d: %llu\n",p, sum);
- }
- return 0;
- }
Saturday, 29 July 2017
Lightoj 1245 - Harmonic Number (II)
Subscribe to:
Post Comments (Atom)
Most Featured Post
Lightoj 1159 - Batman
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
-
http://lightoj.com/volume_showproblem.php?problem=1382 Problem analysis: This is a rare problem i wrote about so far. After much strugg...
-
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
No comments:
Post a Comment