현재 위치 - 중국 분류 정보 발표 플랫폼 - 애완동물 탁송 - 아인슈타인이 제기한 논리적 추론 질문에 대한 답을 누가 알겠습니까?

아인슈타인이 제기한 논리적 추론 질문에 대한 답을 누가 알겠습니까?

한 번에 말로 계산할 수 없어서 인터넷에서 직접 검색해 본 정보는 다음과 같습니다

1 2 3 4 5

노르웨이, 덴마크, 영국, 독일, 스웨덴

노란색 파란색 빨간색 녹색 흰색

Dunhill Blend pall mall prinee binine msier

끓는 물 차 우유 커피 맥주

고양이 말 새 물고기 개

#include lt;iostream.hgt

char* people[5] = {NULL}; [5] = {NULL};

char* 연기[5] = {NULL}

char* drink[5] = {NULL}; >char* pet[5] = {NULL};

/*

char* people[] = {"노르웨이", "덴마크", "영국", "독일" , "스웨덴"};

char* color[] = {"노란색", "파란색", "빨간색", "녹색", "흰색"}

char* smoke[] = {"Dunhill", "Blend" ","Pall Mall","Prinee","Bine Masier"};

char* drink[] = {"끓는 물", "차 ", "우유", "커피", "맥주" };

char* pet[] = {"고양이", "말", "새", "물고기", "개"};

*/

void print_single_result(const char* comment, char* a[])

{

cout lt; lt; lt; endl;

for( int i = 0; i lt; 5; i)

{

if( NULL == a[ i] )

cout lt; "NULL"

cout lt; >cout lt; "\t" lt;

}

}

void print_result()

{

print_single_result("사람", 사람)

print_single_result("color", color); >

print_single_result("연기", 연기)

print_single_result("음료", 음료)

print_single_result("애완동물", 애완동물)

}

int foo( const int level)

int main()

{

if( 0 == foo (0) )

{

print_result();

}

0을 반환

}

상단

{

/ *

0. (drink[2]=="우유")

1. (people[0]=="노르웨이")

2. (people[i]=="UK"amp;amp;color[i]=="red")

3. (people[i]=="스웨덴"amp;amp;pet[i ]=="개")

4. (people[i]=="덴마크"&drink[i]=="차")

5. i]=="그린"&drink[i]=="커피")

6. (smoke[i]=="Bine Masier"amp;amp;drink[i ]= ="맥주")

7. (smoke[i]=="Pall Mall"&pet[i]=="bird")

8. ]=="노란색"amp; smoke[i]=="Dunhill")

9. (people[i]=="Germany"amp; smoke[i ]=="Prinee")

10. (color[i]=="green"&color[j]=="white"amp;(ilt;j))

11. [i]=="Dunhill"amp; pet[j]=="马"amp;amp; (i=j-1||i=j 1))

12. ]=="Blend"amp; pet[j]=="cat"amp;amp; (i=j-1||i=j 1))

13. ="노르웨이"amp;amp;color[j]=="Blue"amp;amp;(i=j-1||i=j 1))

14. ="boiling water"amp;amp;smoke[j]=="Blend"amp;amp;(i=j-1||i=j 1))

*/

스위치(레벨)

{

케이스 0:

{

int isNull = 0; >if( drink[2] != NULL amp; strcmp(drink[2], "milk") ) return 1

if( drink[2] == NULL ) isNull = 1; p>

if( isNull ) drink[2] = "우유";

if( 0 == foo(level 1 ) ) return 0

if( isNull ) drink[2] = NULL;

return 1;

}

break; >{

int isNull = 0;

if( people[0] != NULL amp; strcmp(people[0],"Norway")) return 1; /p>

if( people[0] == NULL

) isNull = 1;

if( isNull ) people[0] = "노르웨이";

if( 0 == foo(level 1) ) return 0;

if( isNull ) people[0] = NULL;

return 1

}

break; :

{

int i = 0;

for( i = 0; i lt; 5; i)

{

int isNull1=0, isNull2=0;

if( people[i] != NULL amp; strcmp(people[i], "UK") ) 계속; >

if( color[i] != NULL amp; amp; strcmp(color[i], "red") ) continue

if( people[i] == NULL ) isNull1 = 1;

if( color[i] == NULL ) isNull2 = 1

if( isNull1 ) people[i] = "영국"

if( isNull2 ) color[i] = "빨간색";

if( 0 == foo(level 1) ) return 0

if( isNull1 ) people[i ] = NULL;

if( isNull2 ) color[i] = NULL

}

return 1; p>

break;

사례 3:

{

int i = 0

for( i = 0; i lt; 5; i)

{

int isNull1=0, isNull2=0

if( people[i] != NULL amp; ; strcmp(people[i], "스웨덴") ) continue;

if( pet[i] != NULL amp; strcmp(pet[i], "dog") ) continue; >

if( people[i] == NULL ) isNull1 = 1;

if( pet[i] == NULL ) isNull2 = 1

if( isNull1 ) people[i] = "스웨덴";

if( isNull2 ) pet[i] = "개"

if( 0 == foo(level 1) ) return 0;

if( isNull1 ) people[i] = NULL;

if( isNull2 ) pet[i] = NULL; >return 1;

}

break;

사례 4:

{

int i = 0 ;

f

또는( i = 0; i lt; 5; i)

{

int isNull1=0, isNull2=0;

if( people[i] != NULL amp; strcmp(people[i], "덴마크") ) continue;

if( drink[i] != NULL amp; strcmp(drink[i], "Tea ") ) 계속 ;

if( people[i] == NULL ) isNull1 = 1

if( drink[i] == NULL ) isNull2 = 1; if( isNull1 ) people[i] = "덴마크";

if( isNull2 ) drink[i] = "tea"

if( 0 == foo (레벨 1) ) 0을 반환합니다.

if( isNull1 ) people[i] = NULL;

if( isNull2 ) drink[i] = NULL; p>

1을 반환

}

중단

상단

{

int i = 0;

for( i = 0; i lt; 5; i )

{

int isNull1=0, isNull2=0

if( color[i] != NULL amp; amp; strcmp(color[i], "green") ) 계속

if( drink[i] != NULL amp; strcmp; (drink[i], "coffee") ) 계속;

if( color[i] == NULL ) isNull1 = 1

if( drink [i] == NULL ) isNull2 = 1;

if( isNull1 ) color[i] = "녹색"

if( isNull2 ) drink[i] = "커피" ; p>if( 0 == foo(레벨 1) ) return 0;

if( isNull1 ) color[i] = NULL

if( isNull2 ) drink[i] = NULL;

}

return 1;

}

break; >

{

int i = 0;

for( i = 0; i lt; 5; i)

{

int isNull1=0, isNull2=0;

if( smoke[i] != NULL amp; strcmp(smoke[i], "Bine Masier") ) 계속;

if( drink[i] != NULL amp; strcmp(drink[i], "beer") ) 계속;

p>

if( smoke[i] == NULL ) isNull1 = 1;

if( drink[i] == NULL ) isNull2 = 1

if( isNull1; ) smoke[i] = "Bine Masier";

if( isNull2 ) drink[i] = "맥주"

if( 0 == foo(level 1) ) return 0;

if( isNull1 ) smoke[i] = NULL;

if( isNull2 ) drink[i] = NULL;

return 1;

}

break;

case 7:

{

int i = 0;

for( i = 0; i lt; 5; i )

{

int isNull1=0, isNull2=0; >

if( smoke[i] != NULL amp; strcmp(smoke[i], "Pall Mall") ) continue;

if( pet[i] != NULL amp; amp; strcmp(pet[i], "bird") ) 계속;

if( smoke[i] == NULL ) isNull1 = 1

if( pet[i] == NULL ) isNull2 = 1;

if( isNull1 ) smoke[i] = "폴 몰";

if( isNull2 ) pet[i] = "새"; >

if( 0 == foo(level 1) ) return 0;

if( isNull1 ) smoke[i] = NULL

if( isNull2 ) pet [i ] = NULL;

}

return 1;

}

break; /p>

{

int i = 0;

for( i = 0; i lt; 5; i)

{ < /p >

int isNull1=0, isNull2=0;

if( color[i] != NULL amp; strcmp(color[i], "yellow") ) 계속; >

if( smoke[i] != NULL amp; strcmp(smoke[i], "Dunhill") ) continue;

if( color[i] == NULL ) isNull1 = 1;

if( smoke[i] == NULL ) isNull2 = 1

if( isNull1 ) color[i] = "노란색"; if( isNull2 ) smoke[i] = "던힐";

if( 0 == foo(level 1) ) return 0

;

if( isNull1 ) color[i] = NULL;

if( isNull2 ) smoke[i] = NULL; p>return 1;

}

break;

case 9:

{

int i = 0;

for( i = 0; i lt; 5; i )

{

int isNull1=0, isNull2=0;

if( people[i] != NULL amp; strcmp(people[i],"독일")) continue;

if( smoke[i] != NULL amp;amp; strcmp( smoke[i], "Prinee") ) 계속;

if( people[i] == NULL ) isNull1 = 1

if( smoke[i] == NULL ) isNull2 = 1;

if( isNull1 ) people[i] = "독일";

if( isNull2 ) smoke[i] = "Prinee"; >if( 0 == foo(레벨 1) ) 0 반환;

if( isNull1 ) people[i] = NULL

if( isNull2 ) smoke[i] = NULL ;

}

1을 반환

}

중단

>{

int i = 0;

for( i = 0; i lt; 5; i )

{

int isNull1=0;

if( color[i] != NULL amp; strcmp(color[i], "green") ) continue; ] == NULL ) isNull1 = 1;

if( isNull1 ) color[i] = "녹색"

int j = i 1; j lt; 5; j )

{

int isNull2=0

if( color[j] != NULL amp; strcmp(color[j], "white") ) 계속;

if( color[j] == NULL ) isNull2 = 1

if( isNull2 ) color[ j] = "흰색";

if( 0 == foo(level 1) ) return 0

if( isNull2 ) color[j] = NULL; >}

if( isNull1 ) color[i] = NULL

}

return 1;

}

p>

휴식

<

p>케이스 11:

{

int i = 0;

for( i = 0; i lt; 5; i)

{

int isNull1=0;

if( smoke[i] != NULL amp; strcmp(smoke[i], "Dunhill") ) 계속; /p>

if( smoke[i] == NULL ) isNull1 = 1;

if( isNull1 ) smoke[i] = "던힐"

if( i -1gt;=0)

{

int j = i-1;

int isNull2=0

if( 애완동물 [j] == NULL || !strcmp(pet[j],"马") )

{

if( pet[j] == NULL ) isNull2 = 1;

if( isNull2 ) pet[j] = "말";

if( 0 == foo(level 1) ) return 0; isNull2 ) pet[j] = NULL;

}

}

if( i 1lt;=4)

{

int j = i 1;

int isNull2=0;

if( pet[j] == NULL || !strcmp(pet[j]," 말") )

{

if( pet[j] == NULL ) isNull2 = 1;

if( isNull2 ) pet[j] = " 말";

if( 0 == foo(level 1) ) return 0;

if( isNull2 ) pet[j] = NULL;

}

}

if( isNull1 ) smoke[i] = NULL

}

return 1; >}

break;

사례 12:

{

int i = 0

for( i = 0; i lt; 5; i)

{

int isNull1=0

if( smoke[i] != NULL amp; ; strcmp(smoke[i], "Blend") ) 계속;

if( smoke[i] == NULL ) isNull1 = 1

if( isNull1 ) ] = "블렌드";

if( i-1gt; =0 )

{

int j = i-1; >int isNull2=0;

if( pet[j] == NULL || !strcmp(pet[j], "cat") )

{

if( 애완동물[j] == NULL ) isNull2 =

1;

if( isNull2 ) pet[j] = "cat";

if( 0 == foo(level 1) )

if( isNull2 ) pet[j] = NULL;

}

}

if( i 1lt;=4)

{

int j = i 1;

int isNull2=0;

if( pet[j] == NULL || !strcmp(pet[j] , "cat") )

{

if( pet[j] == NULL ) isNull2 = 1

if( isNull2 ) pet[j] = "고양이";

if( 0 == foo(level 1) ) return 0

if( isNull2 ) pet[j] = NULL; >}

}

if( isNull1 ) smoke[i] = NULL

}

return 1;

}

break;

사례 13:

{

int i = 0; for( i = 0; i lt; 5; i)

{

int isNull1=0

if( people[i] != NULL amp ; strcmp(people[i], "노르웨이") ) 계속;

if( people[i] == NULL ) isNull1 = 1

[i] = "노르웨이";

if( i-1gt; =0 )

{

int j = i-1;

int isNull2=0;

if( color[j] == NULL || !strcmp(color[j], "blue") )

{

if( color[j] == NULL ) isNull2 = 1;

if( isNull2 ) color[j] = "파란색"

if( 0 == foo(레벨 1) ) 0을 반환합니다.

if( isNull2 ) color[j] = NULL; if( i 1lt;=4)

{

int j = i 1

int isNull2=0; color[j] == NULL || !strcmp(color[j], "blue") )

{

if( color[j] == NULL ) isNull2 = 1 ;

if( isNull2 ) color[j] = "blue";

if( 0 == foo(level 1) ) return 0; ( isNull2 ) 색상[j] = N

ULL;

}

}

if( isNull1 ) people[i] = NULL; >return 1;

}

break;

case 14:

{

int i = 0 ;

for( i = 0; i lt; 5; i )

{

int isNull1=0; drink[i] != NULL amp; strcmp(drink[i], "boiling water") ) continue;

if( drink[i] == NULL ) isNull1 = 1; p>if( isNull1 ) drink[i] = "끓는 물";

if( i-1gt;=0 )

{

int j = i-1;

int isNull2=0;

if( smoke[j] == NULL || !strcmp(smoke[j], "Blend") )

{

if( smoke[j] == NULL ) isNull2 = 1

if( isNull2 ) smoke[j] = "블렌드"

0을 반환

}

}

if( i 1lt;=4)

{

int j = i 1;

int isNull2=0;

if( smoke[j] == NULL || !strcmp(smoke[j], "Blend") )

{

if( smoke[j] == NULL ) isNull2 = 1

if( isNull2 ) smoke[j] = "블렌드";

0을 반환

}

}

if( isNull1 ) drink[i] = NULL; >}

return 1;

}

break;

기본값:

break; >

}

1을 반환합니다.

}