SlideShare uma empresa Scribd logo
1 de 3
project #1
다음 질문들에 답하시오.


•영철은 린다의 남편인가
주어진 Fact로는 추론 할 수 없다. 부부(영철,린다) 또는 아버지(영철,프랭크)라는 Fact 가 주
어진다면 이 명제에 대하여 사실이다.


•누가 철수의 아내인가
은영 부부 (철수, 은영)


•프랭크의 부모는 누구인가
부: 알 수 없다 모: 린다 어머니(린다,프랭크)


•영식의 삼촌은 누구인가
영철, 형제(영철,철수)


•모든 삼촌들을 나열하시오
열철, 형제(철수,영철)이기 때문에 삼촌(영철, 영식),삼촌(영철,영희)
만약, 부부(영철, 린다)이거나 형제(철수,린다)이면, 삼촌(철수,프랭크)


•철수는 린다보다 나이가 많은가
주어진 Fact로는 알 수 없다.


•철수의 어머니는 누구인가
주어진 Fact로는 알 수 없다.
소스//
#include <stdio.h>
#include <stdlib.h>
struct powerset{
char com;
};
typedef struct powerset ps;
void printer(int w[], int i);
void pset(int arr[], int a);
void _powerset(int arr[], int a, int q, int w[], int i);
int main(){
ps *set;
int i=0,j=0,k=0,n=0,m;
메모리 할당// .
set = (ps *)malloc(sizeof(ps));
입력//
while(1){
scanf("%c", &set[i].com);
temp_arr[n] = atoi(temp_ray);
n++;
break;
}
if(set[j].com == ','){
temp_arr[n] = atoi(temp_ray);
n++;
for(k=0; k<i; k++){
temp_ray[k] = 0;
}
k = 0;
j++;
}
temp_ray[k] = set[j].com;
k++;
j++;
}
입력 끝//----------------------------------
pset(temp_arr, n);
printf("%c", 8);
return 0;
}
/*
배열temp_arr =
원소 갯수a =
*/
void pset(int arr[], int a){
int q;
int *w;
w = (int *)malloc(sizeof(int)*a);
for(q=0; q<=a; q++)
_powerset(arr, a, q, w, 0);
free(w);
}
void _powerset(int arr[], int a, int q, int w[], int i){
if(a<q) return;
else if(q<=0){
printer(w,i);
return;
}
else{
w[i] = arr[0];
_powerset(arr+1, a-1, q-1, w, i+1);
_powerset(arr+1, a-1, q, w, i);
}
}
//출력부
void printer(int w[],int I){
int q;
printf(“{”);
if(0<i) printf(“%d”,w[0]);
for(q=1; q<i; q++) printf(“,%d”, w[q]);
printf(“}”);
}

Mais conteúdo relacionado

Destaque

Electronic invoice for Brazil
Electronic invoice for BrazilElectronic invoice for Brazil
Electronic invoice for Brazil
Abiliowg
 
Electronic Submissions
Electronic SubmissionsElectronic Submissions
Electronic Submissions
shakulbio
 

Destaque (9)

Share the Love: using social media to engage donors
Share the Love: using social media to engage donorsShare the Love: using social media to engage donors
Share the Love: using social media to engage donors
 
Tech M&A Monthly - Hottest Tech M&A Ever
Tech M&A Monthly - Hottest Tech M&A EverTech M&A Monthly - Hottest Tech M&A Ever
Tech M&A Monthly - Hottest Tech M&A Ever
 
[페차쿠차] 배움의 기술
[페차쿠차] 배움의 기술[페차쿠차] 배움의 기술
[페차쿠차] 배움의 기술
 
Collaborative Innovation: The State of Engagement
Collaborative Innovation: The State of EngagementCollaborative Innovation: The State of Engagement
Collaborative Innovation: The State of Engagement
 
Electronic invoice for Brazil
Electronic invoice for BrazilElectronic invoice for Brazil
Electronic invoice for Brazil
 
Unit 6 for Advance 2
Unit 6 for Advance 2Unit 6 for Advance 2
Unit 6 for Advance 2
 
Four Great Adventures: OTUS and EPHIALTES & DAEDALUS
Four Great Adventures: OTUS and EPHIALTES & DAEDALUSFour Great Adventures: OTUS and EPHIALTES & DAEDALUS
Four Great Adventures: OTUS and EPHIALTES & DAEDALUS
 
Electronic Submissions
Electronic SubmissionsElectronic Submissions
Electronic Submissions
 
Email Hacking : Comment faire de l'email votre meilleur outil pour engager le...
Email Hacking : Comment faire de l'email votre meilleur outil pour engager le...Email Hacking : Comment faire de l'email votre meilleur outil pour engager le...
Email Hacking : Comment faire de l'email votre meilleur outil pour engager le...
 

Mais de KimChangHoen

자료구조3보고서
자료구조3보고서자료구조3보고서
자료구조3보고서
KimChangHoen
 
자료구조1보고서
자료구조1보고서자료구조1보고서
자료구조1보고서
KimChangHoen
 
자료구조2보고서
자료구조2보고서자료구조2보고서
자료구조2보고서
KimChangHoen
 
자료구조5보고서
자료구조5보고서자료구조5보고서
자료구조5보고서
KimChangHoen
 
자료구조4보고서
자료구조4보고서자료구조4보고서
자료구조4보고서
KimChangHoen
 
자료구조6보고서
자료구조6보고서자료구조6보고서
자료구조6보고서
KimChangHoen
 
이산치7보고서
이산치7보고서이산치7보고서
이산치7보고서
KimChangHoen
 
이산치6보고서
이산치6보고서이산치6보고서
이산치6보고서
KimChangHoen
 
이산치5보고서
이산치5보고서이산치5보고서
이산치5보고서
KimChangHoen
 
이산치4보고서
이산치4보고서이산치4보고서
이산치4보고서
KimChangHoen
 
이산치3보고서
이산치3보고서이산치3보고서
이산치3보고서
KimChangHoen
 

Mais de KimChangHoen (11)

자료구조3보고서
자료구조3보고서자료구조3보고서
자료구조3보고서
 
자료구조1보고서
자료구조1보고서자료구조1보고서
자료구조1보고서
 
자료구조2보고서
자료구조2보고서자료구조2보고서
자료구조2보고서
 
자료구조5보고서
자료구조5보고서자료구조5보고서
자료구조5보고서
 
자료구조4보고서
자료구조4보고서자료구조4보고서
자료구조4보고서
 
자료구조6보고서
자료구조6보고서자료구조6보고서
자료구조6보고서
 
이산치7보고서
이산치7보고서이산치7보고서
이산치7보고서
 
이산치6보고서
이산치6보고서이산치6보고서
이산치6보고서
 
이산치5보고서
이산치5보고서이산치5보고서
이산치5보고서
 
이산치4보고서
이산치4보고서이산치4보고서
이산치4보고서
 
이산치3보고서
이산치3보고서이산치3보고서
이산치3보고서
 

이산치1보고서

  • 1. project #1 다음 질문들에 답하시오. •영철은 린다의 남편인가 주어진 Fact로는 추론 할 수 없다. 부부(영철,린다) 또는 아버지(영철,프랭크)라는 Fact 가 주 어진다면 이 명제에 대하여 사실이다. •누가 철수의 아내인가 은영 부부 (철수, 은영) •프랭크의 부모는 누구인가 부: 알 수 없다 모: 린다 어머니(린다,프랭크) •영식의 삼촌은 누구인가 영철, 형제(영철,철수) •모든 삼촌들을 나열하시오 열철, 형제(철수,영철)이기 때문에 삼촌(영철, 영식),삼촌(영철,영희) 만약, 부부(영철, 린다)이거나 형제(철수,린다)이면, 삼촌(철수,프랭크) •철수는 린다보다 나이가 많은가 주어진 Fact로는 알 수 없다. •철수의 어머니는 누구인가 주어진 Fact로는 알 수 없다.
  • 2. 소스// #include <stdio.h> #include <stdlib.h> struct powerset{ char com; }; typedef struct powerset ps; void printer(int w[], int i); void pset(int arr[], int a); void _powerset(int arr[], int a, int q, int w[], int i); int main(){ ps *set; int i=0,j=0,k=0,n=0,m; 메모리 할당// . set = (ps *)malloc(sizeof(ps)); 입력// while(1){ scanf("%c", &set[i].com); temp_arr[n] = atoi(temp_ray); n++; break; } if(set[j].com == ','){ temp_arr[n] = atoi(temp_ray); n++; for(k=0; k<i; k++){ temp_ray[k] = 0; } k = 0; j++; } temp_ray[k] = set[j].com; k++; j++; } 입력 끝//---------------------------------- pset(temp_arr, n); printf("%c", 8); return 0; } /*
  • 3. 배열temp_arr = 원소 갯수a = */ void pset(int arr[], int a){ int q; int *w; w = (int *)malloc(sizeof(int)*a); for(q=0; q<=a; q++) _powerset(arr, a, q, w, 0); free(w); } void _powerset(int arr[], int a, int q, int w[], int i){ if(a<q) return; else if(q<=0){ printer(w,i); return; } else{ w[i] = arr[0]; _powerset(arr+1, a-1, q-1, w, i+1); _powerset(arr+1, a-1, q, w, i); } } //출력부 void printer(int w[],int I){ int q; printf(“{”); if(0<i) printf(“%d”,w[0]); for(q=1; q<i; q++) printf(“,%d”, w[q]); printf(“}”); }