Acdream 1115--to find the law--salmon and Cat

Source: Internet
Author: User

Math is very important, for those who is also in school, make sure you'll learn more about math.

Salmon and Cat are good friends. Today Salmon ask Cat to help her judge whether a number are perfect or not. Perfect number is a kind of number defined by like this.

First, 1 and 3 are perfect number. Then if A and B were perfect numbers, 2+ab+2a+2b is also a perfect number. For example, 1 and 1 were perfect numbers, so 2+1+2+2 = 7 is perfect number.

If Cat can ' t help Salmon, Salmon'll be sad and Cat'll be much more sad. So Cat must solve the problem to maintain their friendship. Can you help Cat to solve the problem?

Input

This problem contains multiple test cases.

Each test case is contains one line.

Each line contains an interger N, 1≤n≤109.

Output

For each test case, if n is a perfect number, output "Yes", otherwise output "No".

Sample Input

378

Sample Output

Yesyesno

Hint

/*   Find Patterns   . All numbers are the product of 3 or 5 */#include <cstdio> #include <cstring>using namespace Std;int main () {    int n;    while (~SCANF ("%d", &n)) {        n + = 2;        while (n% 3 = = 0) n/= 3;        while (n% 5 = = 0) n/= 5;        if (n = = 1) printf ("yes\n");        else printf ("no\n");    } return 0;}            

  

Acdream 1115--to find the law--salmon and Cat

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.