Problem Description
Mike has many friends. Here are nine of them: Alice, Bob, Carol, Dave, Eve, Frank, Gloria, Henry and Irene.
Mike is so skillful that he can master n languages (aka. programming languages).
His nine friends are all weaker than he. The sets they can master are all subsets of Mike's languages.
But the relations between the nine friends is very complex. Here are some clues.
Now Mike wants to know, how many situations there might be.
Input
The first line contains an integer T(T≤20) denoting the number of test cases.
For each test case, the first line contains an integer n(0≤n≤3000), denoting the number of languages.
Output
For each test case, output ''Case #t:'' to represent this is the t-th case. And then output the answer.
Sample Input
2
0
2
Sample Output
Case #1: 1
Case #2: 1024
https://blog.csdn.net/qq_36556340/article/details/70990281
#include
int main(void)
{
int M,A,B,C,D,E,F,G,H,I;
scanf("%d",&M);//M就是n
if(M>3000||M int count=0;
for(A=0;A for(B=0;B for(C=0;C for(D=0;D for(E=0;E for(F=0;F for(G=0;G for(H=0;H for(I=0;I {
if(A>B)continue;
if(B>C)continue;
if(D>E)continue;
if(E>H)continue;
if(H>I)continue;
if(E>C)continue;
if(D>G)continue;
if(G>F)continue;
if(G>B)continue;//利用continue语句逐一验证判断条件
count++;
printf("COUNT=%d,A=%d,B=%d,C=%d,D=%d,E=%d,F=%d,G=%d,H=%d,I=%d",
count,A,B,C,D,E,F,G,H,I);//逐一条件输出
}
return 0;
}
这是具体实现的步骤,输入输出格式调整一下就行