/*//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)