Nyoj Matchmaker's Troubles (1)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.