Matchmaker's Troubles (1) time limit: +Ms | Memory Limit:65535KB Difficulty:3
-
-
Describe
-
Matchmaker recently encountered a very difficult problem, that is, "left male" "female" rapid growth, and his side of the lack of manpower to every day have to work overtime. Now I need you to help matchmaker solve this problem, the rule of pulling red rope is very simple: Each boy is a number n (1<=n<=500000), the sum of the number n is the number of girls to string.
The factors such as 20 are: 1,2,4,5,10;
-
-
Input
-
-
the first line of the input data is a number T (1<=t<=500000), which indicates the number of groups of test data. Then there is the T-group test data, each set of test data has only one number N (1<=n<=500000).
-
-
Output
-
-
for each set of test data, output a number that represents the second half of the boy who entered the number N.
-
-
Sample input
-
-
321012
-
-
Sample output
-
-
1816
-
-
Same as the prime table
-
-
#include <cstdio> #include <cstdlib> #include <cstring>using namespace Std;const int Max=500002;int a[ Max];void count () {int i,j;for (i=1;i<max/2;++i) for (j=i+i;j<max;j+=i) a[j]+=i;} int main () {count (), int k,n;scanf ("%d", &k), while (k--) {scanf ("%d", &n);p rintf ("%d\n", A[n]);} return 0;}
Nyoj Matchmaker's Troubles (1)