2015 Blue Bridge Cup: 3. Three lamb offering Rui

Source: Internet
Author: User

<title>2015 Blue Bridge Cup: 3. Three lamb offering Rui</title> 2015 Blue Bridge Cup: 3. Three lamb offering Rui
   Auspicious, Sheng Hui +  three sheep------------three sheep Sheng Bling
  1234+ 5672------56328

==>

  9567+ 1085 10652

Compare rotten realization, recursive will not write, later see big God's Bar, small white only will violence ...

int Main(void) {int a[10] = {0}; for(A[1] = 1; a[1] <= 9; a[1]++) { for(a[2] = 0; a[2] <= 9; a[2]++) { for(a[3] = 0; a[3] <= 9; a[3]++) { for(a[4] = 0; a[4] <= 9; a[4]++) { for(A[5] = 1; a[5] <= 9; a[5]++) { for(a[6] = 0; a[6] <= 9; a[6]++) { for(a[7] = 0; a[7] <= 9; a[7]++) { for(A[8] = 0; a[8] <= 9; a[8]++) {int OK= 1; for(int I= 1; I <= 8; i++) { for(int J= 1; J <= 8; J + +) {if(i = = j) {Continue; }if(A[i] = = A[j]) {OK = 0; Break; }                                        }                                    }if(OK) {int NUM1= A[1]*1000+a[2]*100+a[3]*10+a[4];int num2= A[5]*1000+a[6]*100+a[7]*10+a[2];int num3= A[5]*10000+a[6]*1000+a[3]*100+a[2]*10+a[8];if(num1 + num2 = = num3) {printf ("%d\n", NUM1); printf"+%d\n", num2); printf"%d\n", num3);                        }                                    }                                }                            } }                    }                }            }        }    }return0;}

2015 Blue Bridge Cup: 3. Three lamb offering Rui

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.