Descriptioninput only one line of an integer N (0 < N < 1000000). Output has only one row of outputs, the sum of integers m, or f (1) to F (N). Sample Input3
Sample Output5
Hintsource
Day2
Positive solution: Math Problem Solving Report:
It is possible to discuss the contribution of each factor.
1 //It's made by jump~2#include <iostream>3#include <cstdlib>4#include <cstring>5#include <cstdio>6#include <cmath>7#include <algorithm>8#include <ctime>9#include <vector>Ten#include <queue> One#include <map> A#include <Set> - using namespacestd; -typedefLong LongLL; the intN,ans; - -InlineintGetint () - { + intw=0, q=0;CharC=GetChar (); - while((c<'0'|| C>'9') && c!='-') C=getchar ();if(c=='-') q=1, c=GetChar (); + while(c>='0'&& c<='9') w=w*Ten+c-'0', C=getchar ();returnQ? -w:w; A } at -InlinevoidWork () { -N=getint (); for(intI=1; i<=n;i++) ans+=n/i; printf"%d", ans); - } - - intMain () in { - Work (); to return 0; +}
BZOJ1968 [Ahoi2005]common Approximate study