Long Daniel ACM 7-Password Decipher (Shambo)

Source: Internet
Author: User

/*//title: * Password Decipher (Shambo)//Title Description: * An organization to crack an alien password, password by a certain length of string composition. This organization has a number of different lengths of the key to decipher this password, if the length of the two key is exactly the length of this password, * then this password is successfully decoded. Now ask you to program the two keys that will decipher this password. Input Description: * Enter the number of first action keys N (1≤n≤5000) Enter the length of the second behavior password the following n behavior the length of each key//Output Description: * If the key to decipher this password cannot be found, the output is only 1 lines 0. If two cracked keys are found, the output has two lines, each of which is a number of two keys. If there are many decoding schemes, only one can be output. Style input: 1080279473236812649224//style output:*/#include<stdio.h>#include<string.h>#defineMAXN 5000 + 10intA[MAXN];intMain () {intm, N, I, J; Memset (A,0,sizeof(a));//array initialization, header file String.hscanf"%d\n%d\n", &m, &N);  for(i =1; I < m; i++) {scanf ("%d\n", &A[i]); }     for(i =1; I < m; i++)         for(j = i+1; J < M; J + +)            if(n = = (A[i] +A[j])) printf ("%d\n%d\n", I, J); return 0;}//Source Code#include <stdio.h>#defineMAXN 5000 + 10intS[MAXN];intMain () {intN,len,a=0, b=0, I,j; scanf ("%d\n",&N); scanf ("%d\n", &len);//length of the password Len     for(i=0; i<n;i++) scanf ("%d\n",&S[i]);  for(i=0; i<n-1; i++)         for(j=i+1; j<n;j++)            if((s[i]+s[j]) = =Len) {a=i+1; b=j+1;  Break;//jump out of the loop structure            }    if(a!=0&&b!=0) printf ("%d\n%d\n", A, b); Elseprintf ("0");//If you cannot find the key to decipher this password, the output is only 1 lines 0    return 0;}

Long Daniel ACM 7-Password Decipher (Shambo)

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.