2017 official mock game Guess number (violent enumeration) __ Enumeration

Source: Internet
Author: User

Topic:


Ideas:

Use I and J to represent two multipliers, and then determine if two times are available

Code:

#include <stdio.h> #include <string.h> #include <string> #include <iostream> #include <stack > #include <queue> #include <vector> #include <algorithm> #define MEM (a,b) memset (A,b,sizeof (a)) #
Define N 1000+20 #define INF 0x3f3f3f3f #define M 1000000+2000 #define LL long using namespace std;
int num[100];
        int judge (int x)//is judged to be more than two times {while (x) {num[x%10]++;
        if (NUM[X%10]&GT;2) return 0;
    x/=10;
return 1; int main () {for (int i=100;i<=999;i++) {for (int j=100;j<=999;j++) {mem (num,0
            );
            int a=i* (J%10);
            int b=i* (J/10%10);
            int c=i* (J/100%10);
            int s=i*j; if (a>999| | b>999| | c>999| | a<100| | b<100| | c<100| | s>99999| |
            s<10000) continue;
           if (judge (a) &&judge (b) &&judge (c) &&judge (s) &&judge (i) &&judge (j))     printf ("%d\n", s);
} return 0; }


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.