¶
.. 과 간계 . ( 간 결기 .)
. (.ㅎ)
.. 27간 깨 겠... , 그 .
고 1과 0 , 겨 경 .
7개 경 1개, 2개, ... 7개 .
.
9Set ..
1 - 1,2,3,4,5,6,7,8,9
2 - 1 0 0 0 0 0 0 0 0
게 1 경 .
2 - 0 1 0 0 0 0 0 0 0
2 - 0 0 1 0 0 0 0 0 0
2 - 0 0 0 1 0 0 0 0 0
2 - 0 0 0 0 1 0 0 0 0
2 - 0 0 0 0 0 1 0 0 0
2 - 0 0 0 0 0 0 1 0 0
2 - 0 0 0 0 0 0 0 1 0
2 - 0 0 0 0 0 0 0 0 1
거게 .
그 2개 계.... (.ㅎ)
.. 27간 깨 겠... , 그 .
고 1과 0 , 겨 경 .
7개 경 1개, 2개, ... 7개 .
| 걸 간() | |
| 9개 | 0.078 |
| 10개 | 0.172 |
| 11개 | 0.375 |
| 12개 | 0.781 |
9Set ..
1 - 1,2,3,4,5,6,7,8,9
2 - 1 0 0 0 0 0 0 0 0
게 1 경 .
2 - 0 1 0 0 0 0 0 0 0
2 - 0 0 1 0 0 0 0 0 0
2 - 0 0 0 1 0 0 0 0 0
2 - 0 0 0 0 1 0 0 0 0
2 - 0 0 0 0 0 1 0 0 0
2 - 0 0 0 0 0 0 1 0 0
2 - 0 0 0 0 0 0 0 1 0
2 - 0 0 0 0 0 0 0 0 1
거게 .
2 - 1 1 0 0 0 0 0 0 0
2 - 1 0 1 0 0 0 0 0 0
2 - 1 0 0 1 0 0 0 0 0
2 - 1 0 0 0 1 0 0 0 0
2 - 1 0 0 0 0 1 0 0 0
2 - 1 0 0 0 0 0 1 0 0
2 - 1 0 0 0 0 0 0 1 0
2 - 1 0 0 0 0 0 0 0 1
2 - 0 1 1 0 0 0 0 0 0
2 - 0 1 0 1 0 0 0 0 0
2 - 0 1 0 0 1 0 0 0 0
2 - 0 1 0 0 0 1 0 0 0
2 - 0 1 0 0 0 0 1 0 0
2 - 0 1 0 0 0 0 0 1 0
2 - 0 1 0 0 0 0 0 0 1
2 - 0 0 1 1 0 0 0 0 0
.
.
()
경 .^^
겨.^^*
2 - 1 0 1 0 0 0 0 0 0
2 - 1 0 0 1 0 0 0 0 0
2 - 1 0 0 0 1 0 0 0 0
2 - 1 0 0 0 0 1 0 0 0
2 - 1 0 0 0 0 0 1 0 0
2 - 1 0 0 0 0 0 0 1 0
2 - 1 0 0 0 0 0 0 0 1
2 - 0 1 1 0 0 0 0 0 0
2 - 0 1 0 1 0 0 0 0 0
2 - 0 1 0 0 1 0 0 0 0
2 - 0 1 0 0 0 1 0 0 0
2 - 0 1 0 0 0 0 1 0 0
2 - 0 1 0 0 0 0 0 1 0
2 - 0 1 0 0 0 0 0 0 1
2 - 0 0 1 1 0 0 0 0 0
.
.
()
경 .^^
겨.^^*
¶
~cpp
#include <time.h>
#include <stdio.h>
#include <iostream>
int* input_and_return_number(int*);
void process(int*, int);
int main()
{
int time_in; // 기 간.
/////
int gaesu;
int *temp_gaesu=&gaesu;
int *numbers=input_and_return_number(&gaesu);
/////
time_in = clock(); // 기 간 .
process(numbers,gaesu);
free(numbers);
printf("CPU CLOCKS = %d\n", clock() - time_in); // 간 - 기 간 = 그 간
return 0; // 그 .
}
int* input_and_return_number(int *number_gaesu)
{
printf(" 개?>>");
fflush(stdin);
scanf ("%d",number_gaesu);
int *numbers=(int*)malloc(sizeof(int)*(*number_gaesu));
for (register int i=0; i<*number_gaesu; ++i)
{
printf("%d .>>",i+1);
fflush(stdin);
scanf("%d",numbers+i);
}
return numbers;
}
void process(int *numbers, int gaesu)
{
int *temp_where=(int*)malloc(sizeof(int)*gaesu);
for (register int temp_gaesu=1; temp_gaesu<=gaesu; ++temp_gaesu)
{
int bun_ja=1;
int bun_mo=1;
for (register int i=0; i<temp_gaesu; ++i)
{
bun_ja*=gaesu-i;
bun_mo*=i+1;
}
int combination=bun_ja/bun_mo;
for (register int i=0; i<gaesu; ++i)
{
if (i<temp_gaesu)
temp_where[i]=1;
else
temp_where[i]=0;
}
for (register int i=0; i<combination; ++i)
{
printf("{");
int end=gaesu-1;
for (register int j=0; j<gaesu; ++j)
{
if(1==temp_where[j])
printf(" %d ",numbers[j]);
}
printf("} ");
int find_last=end;
for (; find_last>=0; --find_last)
{
if (1==temp_where[find_last])
break;
}
if (find_last==end)
{
int gaesu_of_one=0;
int find_zero=0;
for (register int j=end; j>=0; --j)
{
if (0==temp_where[j])
find_zero=1;
else
{
temp_where[j]=0;
if (0==find_zero)
++gaesu_of_one;
else
{
for (register int k=j+1; k<j+2+gaesu_of_one; ++k )
temp_where[k]=1;
break;
}
}
}
}
else
{
temp_where[find_last]=0;
temp_where[find_last+1]=1;
}
}
}
free(temp_where);
}










