305379: CF1017F. The Neutral Zone
Memory Limit:16 MB
Time Limit:5 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
The Neutral Zone
题意翻译
定义 $\text{exlog} _ f(p _ 1^{a _ 1}p _ 2^{a _ 2}...p _ k^{a _ 2}) = a _ 1 f(p _ 1) + a _ 2 f(p _ 2) + ... + a _ k f(p _ k)$,其中 $f(x)=Ax^3+Bx^2+Cx+D$ ,求 $\sum _ {i=1} ^ n \text{exlog} _ f(i)$ $1 \le n \le 3 \times 10 ^ 8,0 \le A,B,C,D \le 10 ^ 6$题目描述
Notice: unusual memory limit! After the war, destroyed cities in the neutral zone were restored. And children went back to school. The war changed the world, as well as education. In those hard days, a new math concept was created. As we all know, logarithm function can be described as: $ $ \log(p_1^{a_1}p_2^{a_2}...p_k^{a_2}) = a_1 \log p_1 + a_2 \log p_2 + ... + a_k \log p_k $ $ Where $ p\_1^{a\_1}p\_2^{a\_2}...p\_k^{a\_2} $ is the prime factorization of a integer. A problem is that the function uses itself in the definition. That is why it is hard to calculate.</p><p>So, the mathematicians from the neutral zone invented this: $ $ \text{exlog}_f(p_1^{a_1}p_2^{a_2}...p_k^{a_2}) = a_1 f(p_1) + a_2 f(p_2) + ... + a_k f(p_k) $ $ </p><p>Notice that $ \\text{exlog}\_f(1) $ is always equal to $ 0 $ .</p><p>This concept for any function $ f $ was too hard for children. So teachers told them that $ f $ can only be a polynomial of degree no more than $ 3 $ in daily uses (i.e., $ f(x) = Ax^3+Bx^2+Cx+D $ ).</p><p>"Class is over! Don't forget to do your homework!" Here it is: $ $ \sum_{i=1}^n \text{exlog}_f(i) $ $ </p><p>Help children to do their homework. Since the value can be very big, you need to find the answer modulo $ 2^{32}$.输入输出格式
输入格式
The only line contains five integers $ n $ , $ A $ , $ B $ , $ C $ , and $ D $ ( $ 1 \le n \le 3 \cdot 10^8 $ , $ 0 \le A,B,C,D \le 10^6 $ ).
输出格式
Print the answer modulo $ 2^{32} $ .
输入输出样例
输入样例 #1
12 0 0 1 0
输出样例 #1
63
输入样例 #2
4 1 2 3 4
输出样例 #2
136