Non-contact number (Hangzhou electric 1999)

Source: Internet
Author: User

/* Non-contact number
Problem Description
S (n) it is a positive integer n the sum of the true coefficients, less than n divisible by n factors. For example S (12) =1+2+3+4+6=16. Whatever assumptions
Number M,s (m) is not equal to N, claiming n non-contact number.

Input
Includes multiple sets of data, first entering T, which indicates that there is a T group of data. 1 rows per set of data give N (2<=n<=1000) is an integer.

Output
Assuming n is not touched, output yes, otherwise output no

Sample Input
3
2
5
8

Sample Output
Yes
Yes
No

*/
/* Use the table method to place the true factor of N and save to A[n].
Note that the upper limit of the table is determined m>=500000;
*/
#include <stdio.h>
#define M 500010
__int64 A[m];
int sum[1010];
void ASD ()
{
int N;
N=M/2;
int i,j;
for (i=1;i<n;i++)
for (j=2*i;j<m;j+=i)
A[j]+=i;
for (i=0;i<m;i++)
{
if (a[i]<=1000)
Sum[a[i]]=1;
}
}
int main ()
{
int test,i;
scanf ("%d", &test);
ASD ();
while (test--)
{
int t;
scanf ("%d", &t);
if (Sum[t])
printf ("no\n");
Else
printf ("yes\n");
}
return 0;
}

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

Non-contact number (Hangzhou electric 1999)

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.