题目

ranch

보안 사항 필독

 

SW개발 역량검정 문제지는 출제 과정에서

많은 리소스가 투입된 당사의 지적 자산입니다.

 

향후 사내교육, 인력채용, 해외연구소 평가 등에

지속적으로 재사용 될 예정이므로, 출제 내용에

대해서 누설 및 자료 재전송을 절대 禁하며,

未 준수로 인한 유출 時 당사 정보보호규정의

위규사항 해당하므로 필히 숙지 바랍니다.

 

여러분 선배, 동료, 후배 연구원들의 성공적인

SW역량강화 추진을 위해 협조를 당부드립니다.

 

개발실 SW역량강화분과

 

 

 

 

 

[문제] 다음 조건을 만족하는 C언어 함수를 작성하라.

한씨는 정년 퇴임을 앞두고 목장을 운영하기 위해 목장 매물을 조사하고 있고, 여러 지역의 부동산 업자로부터 다양한 농장의 대지 정보를 받고 있는데, 가능하면 많은 종류의 동물을 키우고자 한다. 이를 위해 하기와 같은 목장 정보를 바탕으로 울타리로 둘러싸인 영역이 몇 개인지를 카운트 하는 함수를 작성하시오.

[조건]

대지의 크기는 100 X 100이며, 대지의 바깥은 외곽 울타리가 세워져 있다.

대지 맵 정보는 char [100][100]으로 주어지며, 각 char 정보에는 울타리를 나타내는 ‘+’ 또는 빈 공간을 나타내는 스페이스 문자 ' '가 존재한다.

# 카운트 예시 (4 X 6 단위 농장의 경우)

  하기와 같이 영역 판정은 앞뒤좌우 및 대각선까지 울타리로 보호되는 경우이다.

     영역 2개                  영역 1개 (대각선 방향으로 열려 있으므로 영역은 1개임)

 

# 카운트 예시 (8 X 6 단위 농장의 경우)

            영역 4개 (대지 바깥은 외곽 울타리가 있으므로 녹색이나 노란색 영역도 카운트 해야 함)

 

 

 

 

 

 

 

 

 

[첨부 1 – single.cpp]

 

// DO NOT INCLUDE ANY FILES

 

int run_test(char ranch[100][100])

{

        return 0;

}

 

[첨부 2 – main.cpp]

 

#include <stdio.h>

#include <stdlib.h>

 

int run_test(char ranch[100][100]);

 

void main(void)

{

      static char ranch[100][100];

 

      for (int c = 0; c < 10; c++)

      {

           for (int y = 0; y < 100; y++)

                 for (int x = 0; x < 100; x++)

                      ranch[x][y] = ' ';

 

           for (int c = 0; c < 10000; c++)

                 ranch[rand() % 100][rand() % 100] = '+';

 

           printf("%d ", run_test(ranch));

      }

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that   plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW    proficiency of your colleagues.      

 

Mobile R&D Office

SW Proficiency Buildup Dep.

 

 

[Problem] Write a C function which meets following conditions.

Mr. Han is searching ranches for sale in order to run a ranch after his retirement. He is receiving a lot of information about the ranch lands from realtors, and he wants to raise as many kinds of animals as possible. For this, write a C function which counts the number of areas which are surrounded by fences, based on the information about the land below.

[Constraints]

The size of the land is 100 X 100, and there are surrounding fences outside of the land. 

The information about the land is provided as char [100][100], and in each char information, there is ‘+’ ,which indicates a fence or there is a space char ' ',which indicates a vacant room. 

# Example Count (in a ranch of size 4 X 6) 

As seen below, if some vacant rooms are surrounded by fences in all directions: front, back, left, right and diagonal, it will be counted as one area.    

 

      2 areas                   1 area

(Only one area is counted because two sides of the green part are diagonally open.)

 

# Example Count (in a ranch of size 8 X 6) 

             4 areas

 (Green and yellow parts should be counted since there are surrounding fences outside of the land.)

 

 

 

 

 

 

[file 1 – single.cpp]

 

// DO NOT INCLUDE ANY FILES

 

int run_test(char ranch[100][100])

{

        return 0;

}

 

[file 2 – main.cpp]

 

#include <stdio.h>

#include <stdlib.h>

 

int run_test(char ranch[100][100]);

 

void main(void)

{

      static char ranch[100][100];

 

      for (int c = 0; c < 10; c++)

      {

           for (int y = 0; y < 100; y++)

                 for (int x = 0; x < 100; x++)

                      ranch[x][y] = ' ';

 

           for (int c = 0; c < 10000; c++)

                 ranch[rand() % 100][rand() % 100] = '+';

 

           printf("%d ", run_test(ranch));

      }

}

 

 

 infect

보안 사항 필독

 

SW개발 역량검정 문제지는 출제 과정에서

많은 리소스가 투입된 당사의 지적 자산입니다.

 

향후 사내교육, 인력채용, 해외연구소 평가 등에

지속적으로 재사용 될 예정이므로, 출제 내용에

대해서 누설 및 자료 재전송을 절대 禁하며,

未 준수로 인한 유출 時 당사 정보보호규정의

위규사항 해당하므로 필히 숙지 바랍니다.

 

여러분 선배, 동료, 후배 연구원들의 성공적인

SW역량강화 추진을 위해 협조를 당부드립니다.

 

개발실 SW역량강화분과

 

 

 

 

 

[문제] 다음 조건을 만족하는 C언어 함수를 작성하라.

어느 날 디트로이트 시티에 좀비가 나타났다. 좀비는 주변 사람들을 감염시키면서 그 개체 수를 조금씩 늘려 가고 있는데, 행동방식을 보면 1초마다 앞뒤좌우 네 방향에 이웃한 사람들을 감염시키고 있다.

(대각선에 위치한 사람들은 감염시키지 못함)

아래 왼쪽 그림의 경우, 정상인 X가 모여 있는 곳에 좀비 O가 있다면, 5초 후에 모든 사람이 좀비가 된다.

(오른쪽 그림에 표시된 숫자들이 좀비로 감염되는 시간임)

 

 위의 그림과 같은 경우에는 모두 감염 시키는데 총 5초가 걸렸으며, 1명이 감염되지 않고 생존 하였다.

100 X 100 크기의 지도와, 사람들이 있는 위치가 주어지고, 감염되어 있는 한명의 좀비 위치가 주어질 때, 총 몇 초 만에 모두 감염되는지, 생존자는 몇 명인지를 확인하는 함수를 작성하시오.

[구현 함수]

unsigned int run_test(int map[100][100], unsigned int x, unsigned int y, unsigned int* person)

map[100][100]: 디트로이트 시티의 맵 정보이다.

           1 은 사람이 있는 곳이며, 0 은 아무도 존재 하지 않는 곳이다.

           Map [ x 좌표 ] [ y 좌표 ] 의 순서로 x, y 좌표가 주어진다.

x : 좀비가 존재하는 x 위치

y : 좀비가 존재하는 y 위치

person: 감염되지 않은 사람의 수를 계산하여 반환함.

Return value: 감염 가능한 위치에 있는 사람들이, 모두 감염되는 총 시간을 반환 한다.

[첨부 1 – single_id.cpp]

 

// DD NOT INCLUDE ANY FILES

 

unsigned int run_test(int map[100][100], unsigned int x, unsigned int y, unsigned int* person)

{

    // WRITE YOUR CODES HEAR

 

    *person = 0; // 감염되지 않은 사람 수

    return 0; // 전체 감염 시간 (초)

}

 

 

 

 

 

 

 

 

 

 

[첨부 2 – main.cpp]

 

#include <stdlib.h>

#include <stdio.h>

 

 

unsigned int run_test(int map[100][100], unsigned int x, unsigned int y, unsigned int* person);

 

 

void main(void)

{

    int           map[100][100];

    unsigned int time;

    unsigned int person;

 

    for (int x = 0; x < 100; x++ )

        for( int y = 0; y < 100; y++ )

            map[x][y] = ((rand() % 3) != 0) ? 1 : 0;

   

    time = run_test(map, rand() % 100, rand() % 100, &person);

 

    printf("Time: %d, Person: %d ", time, person);

}

 

 

 


Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that   plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW    proficiency of your colleagues.       

 

Mobile R&D Office

SW Proficiency Buildup Dep.

 

[Problem] Write a C function which meets following conditions.  

One day, zombies haunted the City of Detroit. Zombies are increasing their numbers, infecting other people around them. Every one second, they are infecting people neighboring in the four directions: front, back, left, and right. 

(They cannot infect people on the diagonal.)   

In the picture on the left below, if there is zombie ‘O’ among normal people ‘X’, all people will become zombies after five seconds. (The numbers in the picture on the right is a time for which people are infected.)

O: Zombie

X: People who are not infected

 

 

 

 

In the picture above, it took five seconds for all people to be infected, and one person survived, not being infected.  

Given a map of size 100 X 100 and the positions of people and one zombie who is infected, write a C function which returns the time (second) for which all people are infected and the number of survivors.  

 

[A function that you have to implement]   

unsigned int run_test(int map[100][100], unsigned int x, unsigned int y, unsigned int* person)

map[100][100]:  map data about the City of Detroit.

         1 indicates the place where there is a person, and 0 indicates the place where there is nobody.      

x and y coordinates are given in order of Map [ x-coordinate] [ y-coordinate]. 

x : x-coordinate where there is a zombie

y : y-coordinate where there is a zombie

person: return the number of people who are not infected.

Return value: return the total time for which all people, who can be infected due to their positions, are infected.

[file 1 – single_id.cpp]

 

// DD NOT INCLUDE ANY FILES

 

unsigned int run_test(int map[100][100], unsigned int x, unsigned int y, unsigned int* person)

{

    // WRITE YOUR CODES HEAR

 

    *person = 0; // the number of people who are not infected

    return 0; // the total time for which all people are infected (second)

}

 

 

 

 

 

 

 

 

 


[file 2 – main.cpp]

 

#include <stdlib.h>

#include <stdio.h>

 

 

unsigned int run_test(int map[100][100], unsigned int x, unsigned int y, unsigned int* person);

 

 

void main(void)

{

    int           map[100][100];

    unsigned int time;

    unsigned int person;

 

    for (int x = 0; x < 100; x++ )

        for( int y = 0; y < 100; y++ )

            map[x][y] = ((rand() % 3) != 0) ? 1 : 0;

   

    time = run_test(map, rand() % 100, rand() % 100, &person);

 

    printf("Time: %d, Person: %d ", time, person);

}

 

 

 

 Anaconda(肯丰)

보안 사항 필독

 

SW개발 역량검정 문제지는 출제 과정에서

많은 리소스가 투입된 당사의 지적 자산입니다.

 

향후 사내교육, 인력채용, 해외연구소 평가 등에

지속적으로 재사용 될 예정이므로, 출제 내용에

대해서 누설 및 자료 재전송을 절대 禁하며,

未 준수로 인한 유출 時 당사 정보보호규정의

위규사항 해당하므로 필히 숙지 바랍니다.

 

여러분 선배, 동료, 후배 연구원들의 성공적인

SW역량강화 추진을 위해 협조를 당부드립니다.

 

개발실 SW역량강화분과

 

 

 

 

 

[문제] 다음 조건을 만족하는 C언어 함수를 작성하라.

국제 환경단체는 아나콘다의 서식지를 조사하기로 하고 위성에 탑재된 열 탐지 카메라를 이용하여 아나콘다 서식지에 대한 영상 정보를 확보 하였다. 이 정보를 토대로 아나콘다의 각 개체 크기를 분석하는 시스템을 구축하고자 한다.

열 탐지 카메라로부터 확보된 정보는 후처리 과정을 통하여, 2차원 평면상 패턴들로 표현이 된다. 아래 <그림 1>의 경우 주어진 2차원 배열에서 서식지 수면은 ‘0’으로, 아나콘다 개체의 패턴은 ‘1’로 나타내고 있으며, 연속된 1의 패턴이 7개 있으므로, <그림 1>은 해당 영역에 총 7마리의 아나콘다가 서식하고 있음을 알 수 있다.

이들 중 가장 긴 개체의 길이를 알아내는 것이 목표이다. 개체의 길이는 <그림 2>에서 보여지듯 연속된 1의 개수를 구하면 된다. 노란색으로 표시한 1이 모두 21개이므로 <그림 2>에 나타난 아나콘다의 길이는 21이 된다.

 

<그림 1> 2차원 배열 상의 패턴의 형태

 

<그림 2> 아나콘다의 길이 = 21 (노란색 표시)

위의 설명을 참고하여, 주어진 1000 x 1000 크기의 2차원 배열을 분석하여, 가장 긴 아나콘다 개체의 길이를 계산하는 함수를 작성하시오. 단 모든 개체는 상호 떨어져 있으며 겹치거나 교차하지 않는다.

(모든 연결되는 ‘1’은 정확히 앞뒤좌우로 연결되며 대각선으로 연결되는 경우는 없다.)

[첨부 1 – single_id.cpp]

// DO NOT INCLUDE ANY FILES

 

#define SIZE 1000

 

int run_test(const char snake[SIZE][SIZE])

{

    // WRITE YOUR CODES HEAR

 

    return 0; // 가장 긴 아나콘다의 길이

}

 

[첨부 2 – main.cpp]

#include <stdio.h>

#include <stdlib.h>

 

#define SIZE       1000

#define THICKNESS 4

 

int run_test(const char snake[SIZE][SIZE]);

 

static char snake[10][SIZE][SIZE];

 

void build_snake(void)

{

  for (int l = 0; l < 10; l++)

  {

    for(int y = 0; y < SIZE; y++)

      for(int x = 0; x < SIZE; x++)

        snake[l][x][y] = 0;

 

        for (int k = 0; k < 99; k++) // limit of snakes

        {

          int flag = 1;

          int curX = (rand() % ((SIZE - THICKNESS * 10) / THICKNESS)) * THICKNESS + THICKNESS * 10;

          int curY = (rand() % ((SIZE - THICKNESS * 10) / THICKNESS)) * THICKNESS + THICKNESS * 10;

       

          for(int j = -10 * THICKNESS; j < 10 * THICKNESS; j++)

            for(int i = -10 * THICKNESS; i < 10 * THICKNESS; i++)

              if (snake[l][j + curX][i + curY]) flag = 0;

 

              if (flag)

              {

                for(int i = 0; i < SIZE / 40; i++)

                {

                  int dir = rand() % 4;

                  int progress = (rand() % 40) * THICKNESS + THICKNESS;

 

                  if (dir == 0)  // Right

                  {

                    for (; curY < progress; curY++)

                      if ((snake[l][curX][curY + THICKNESS] + snake[l][curX - 1][curY + THICKNESS] +

                      snake[l][curX + 1][curY + THICKNESS]))

                        break;

                      else

                        snake[l][curX][curY] = 1;

                  }

                  else if (dir == 1) // Left

                  {

                    for (; curY > progress; curY--)

                      if ((snake[l][curX][curY - THICKNESS] + snake[l][curX - 1][curY - THICKNESS] +

                      snake[l][curX + 1][curY - THICKNESS]))

                        break;

                      else

                        snake[l][curX][curY] = 1;

                    }

                    else if (dir == 2) // Up

                    {

                      for (; curX > progress; curX--)

                        if ((snake[l][curX - THICKNESS][curY] + snake[l][curX - THICKNESS][curY - 1] +

                        snake[l][curX - THICKNESS][curY + 1]))

                          break;

                        else

                          snake[l][curX][curY] = 1;

                    }

                    else if (dir == 3) // Down

                    {

                      for (; curX < progress; curX++)

                        if ((snake[l][curX + THICKNESS][curY] + snake[l][curX + THICKNESS][curY - 1] +

                        snake[l][curX + THICKNESS][curY + 1]))

                          break;

                        else

                          snake[l][curX][curY] = 1;

                    }

                  }

               }

         }

  }

}

 

void main(void)

{

    build_snake();

    for (int count = 0; count < 10; count++)

        printf("%d ", run_test(snake[count]));

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that   plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW    proficiency of your colleagues.      

 

Mobile R&D Office

SW Proficiency Buildup Dep.

 

[Problem] Write a C function which meets following conditions.   

 

International Environmental Organization decided to conduct a research about the habitats of anacondas and gained visual information about the habitats of anacondas, using a thermographic camera. Using this information, we are going to set up a system which analyzes the size of each individual anaconda.  

The information gained from a thermographic camera is expressed as patterns in a two-dimensional array though post-processing. In the case of <Figure.1>, given a two-dimensional array, the surface of the water in anacondas’ habitat is expressed as ‘0’ and the pattern of individual anaconda is expressed as ‘1.’ Since there are seven consecutive patterns of ‘1’ we can figure out that there are seven anacondas in the relevant area.

The goal is to find out the length of anaconda which is the longest. The length of an individual anaconda is the number of consecutive ‘1’ as seen in the <Figure.2>. Since the number of ‘1’ is 21 as marked in yellow color, the length of anaconda in the <Figure.2> is 21.  

 

<Figure.1> Forms of patterns in a two-dimensional array 

 

<Figure.2> Length of anaconda = 21 (yellow marks)  

Refer to the explanation above and write a C function which calculates the length of the longest anaconda, analyzing a given two-dimensional array of size 1000 x 1000. Every individual anaconda is placed apart and not overlapped and crossed.  (Every ‘1’ is adjacent each other in four directions: front, back, left, and right. There is no case in which each ’1’ is adjacent in the diagonal direction.)

[file 1 – single_id.cpp]

// DO NOT INCLUDE ANY FILES

 

#define SIZE 1000

 

int run_test(const char snake[SIZE][SIZE])

{

    // WRITE YOUR CODES HEAR

 

    return 0; // the length of the longest anaconda

}

 

 

[file 2 – main.cpp]

#include <stdio.h>

#include <stdlib.h>

 

#define SIZE       1000

#define THICKNESS 4

 

int run_test(const char snake[SIZE][SIZE]);

 

static char snake[10][SIZE][SIZE];

 

void build_snake(void)

{

  for (int l = 0; l < 10; l++)

  {

    for(int y = 0; y < SIZE; y++)

      for(int x = 0; x < SIZE; x++)

        snake[l][x][y] = 0;

 

        for (int k = 0; k < 99; k++) // limit of snakes

        {

          int flag = 1;

          int curX = (rand() % ((SIZE - THICKNESS * 10) / THICKNESS)) * THICKNESS + THICKNESS * 10;

          int curY = (rand() % ((SIZE - THICKNESS * 10) / THICKNESS)) * THICKNESS + THICKNESS * 10;

       

          for(int j = -10 * THICKNESS; j < 10 * THICKNESS; j++)

            for(int i = -10 * THICKNESS; i < 10 * THICKNESS; i++)

              if (snake[l][j + curX][i + curY]) flag = 0;

 

              if (flag)

              {

                for(int i = 0; i < SIZE / 40; i++)

                {

                  int dir = rand() % 4;

                  int progress = (rand() % 40) * THICKNESS + THICKNESS;

 

                  if (dir == 0)  // Right

                  {

                    for (; curY < progress; curY++)

                      if ((snake[l][curX][curY + THICKNESS] + snake[l][curX - 1][curY + THICKNESS] +

                      snake[l][curX + 1][curY + THICKNESS]))

                        break;

                      else

                        snake[l][curX][curY] = 1;

                  }

                  else if (dir == 1) // Left

                  {

                    for (; curY > progress; curY--)

                      if ((snake[l][curX][curY - THICKNESS] + snake[l][curX - 1][curY - THICKNESS] +

                      snake[l][curX + 1][curY - THICKNESS]))

                        break;

                      else

                        snake[l][curX][curY] = 1;

                    }

                    else if (dir == 2) // Up

                    {

                      for (; curX > progress; curX--)

                        if ((snake[l][curX - THICKNESS][curY] + snake[l][curX - THICKNESS][curY - 1] +

                        snake[l][curX - THICKNESS][curY + 1]))

                          break;

                        else

                          snake[l][curX][curY] = 1;

                    }

                    else if (dir == 3) // Down

                    {

                      for (; curX < progress; curX++)

                        if ((snake[l][curX + THICKNESS][curY] + snake[l][curX + THICKNESS][curY - 1] +

                        snake[l][curX + THICKNESS][curY + 1]))

                          break;

                        else

                          snake[l][curX][curY] = 1;

                    }

                  }

               }

         }

  }

}

 

void main(void)

{

    build_snake();

    for (int count = 0; count < 10; count++)

        printf("%d ", run_test(snake[count]));

}

 

 baby_gin

 

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that   plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW    proficiency of your colleagues.     

 

Mobile R&D Office

SW Proficiency Buildup Dep.

[Problem] Write a C function which meets following conditions. (Development time: 3 hours)

 

Assignment: Baby-gin

When randomly selecting 6 cards from the cards of number 0~9, we are going to define a case in which 3 cards have consecutive numbers as ‘run’, and define a case in which 3 cards have the same number as ‘triplete.’ In addition, when all 6 cards consist of only ‘run’ and ‘triplete,’ this case is going to be called ‘baby-gin’.

ž   667767 has two ‘tripletes,’ therefore it is ‘baby-gin.’ (666, 777)

ž   123456 has two ‘run,’ therefore it is ‘baby-gin.’ (123,456)

ž   054060 has one ‘run’ and one ’triplete,’ therefore it is also ‘baby-gin.’ (456, 000)

ž   101123 has one ‘triplete,’ but 023 is not ‘run,’ therefore it is not ‘baby-gin.’ (Even if you are to use 123 as ‘run,’ 011 is ‘run’ but not ‘triplete.’)

Write a program which gets inputs of 6 numbers from a user and judges whether they are ‘baby-gin.’

 

Output Screen 

 

 

 card 无法打开

 

 contact

 

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW proficiency of your colleagues.

 

Mobile R&D Office

SW Proficiency Buildup Dep.

 

[Problem] Write a C function which meets following conditions. (Development time: 4 hours)

Given information about a ‘network of emergency contacts’ and a person who is on duty of making calls first, write a C function that finds the person who has the largest number among those who are contacted last.

 

[Example]

Below is the picture showing a ‘network of emergency contacts.’

 

 

Each circle means each individual person and the number in it presents the number of each person. A red circle indicates the person who is on duty of making calls first. Arrows mean the directions in which contacting is possible. In this example above, the number 7 and 1 can contact each other, however, in case of the number 2 and 7, the number 2 can contact the number 7, but not vise versa.

If contacting is started through this ‘network of emergency contacts,’ the number 2 who is on duty of making calls first will contact the number 7 and 15 simultaneously. (Assume that a conference call is used.)

 

 

 

Then, the number 7 contacts the number 1 and the number 15 contacts the number 4.

(Assume that contacting happens at the same time.)

 

 

 

And then, the number 1 simultaneously contacts the number 8 and 17 and at the same time, the number 4 contacts the number 10 like below. Since the number 7 and 2 have already been contacted, they will not be contacted again.

 

The picture above shows the final state in which all possible contacts are reached. There are three persons, the number 8, 10, and 17, who are contacted last. Among those, the largest number is 17, therefore, return 17.

 

※     The number 3, 6, 11, 22 will not be able to get reached after all.

 

[Constraints]

Any external libraries or the header file cannot be used. (You will be failed if you use #include <stdio.h>,etc)

When evaluating your solution, main.cpp will not be changed.

 

The number of contact persons is maximum 100, and the number which can be assigned is from 1 to 100, inclusive. But, as the number 5 does not exist in this example, there can be the numbers which are vacant.

If one person is able to reach many people, all contacts are done at the same time though a conference call.

The speed at which contact is reached is always constant. (The speed at which a person who received a call makes a call to the next person is the same.)

Information about a network of emergency contacts is shared in advance and the person who was contacted once will not be contacted again. Like the number 3,6,11, and 22 in this example, there can be the persons who will not be able to get reached after all.

 

[A function that you have to implement]

 

int test_main(int data[300], int startNum)

 

data[300] : data about a network of emergency contacts is given.

Data is interpreted in order of{from, to, from, to, …}

In the example above, the data is like {2, 7, 11, 6, 6, 2, 2, 15, 15, 4, 4, 2, 4, 10, 7, 1, 1, 7, 1, 8, 1, 17, 3, 22}.

(Pay attention to the fact that there are 24 numbers- just for this example- not 300.)

However, the place of these pairs does not make any difference, therefore, following input indicates the same ‘network of emergency contacts’. (There can be various inputs which present the same ‘network of emergency contacts.’)

{1, 17, 3, 22, 1, 8, 1, 7, 7, 1, 2, 7, 2, 15, 15, 4, 6, 2, 11, 6, 4, 10, 4, 2}

 

There can be a case that the same {from, to} pair is repeated several times as follows, and there is no difference between a case in which the same pair is recorded once and recorded more times.

{1, 17, 1, 17, 1, 17, 3, 22, 1, 8, 1, 7, 7, 1, 2, 7, 2, 15, 15, 4, 6, 2, 11, 6, 4, 10, 11, 6, 4, 2}

 

startNum : information about a person who is on duty of contacting first (In this example, it is 2)

 

return : return the number of the person who has the largest number among those who are contacted last.

 

[file 1 – your_ID_number.cpp]

// DO NOT INCLUDE ANY FILES

int test_main(int data[300], int startNum)

{

return 0;

}

 

[file 2 – main.cpp]

#include <stdio.h>

#include <stdlib.h>

 

int test_main(int data[300], int startNum);

 

static void build_data(int data[300])

{

for (int i = 0; i < 300; i++)

{

data[i] = rand() % 100 + 1;

}

}

 

void main(void)

{

int data[300];

 

for (int l = 0; l < 10; l++)

{

build_data(data);

printf("%d ", test_main(data, data[0]));

}

}

 

 

 

 

 Cross(肯丰)

보안 사항 필독

 

본 SW개발 역량검정 문제지는 출제 과정에서

많은 리소스가 투입된 당사의 지적 자산입니다.

 

향후 사내교육, 인력채용, 해외연구소 평가 등에

지속적으로 재사용 될 예정이므로, 출제 내용에

대해서 누설 및 자료 재전송을 절대 禁하며,

未 준수로 인한 유출 時 당사 정보보호규정의

위규사항 해당하므로 필히 숙지 바랍니다.

 

여러분 선배, 동료, 후배 연구원들의 성공적인

SW역량강화 추진을 위해 협조를 당부드립니다.

 

개발실 SW역량강화분과

 

 

 

 

 

[문제] 다음 조건을 만족하는 C언어 함수를 작성하라.

아래 그림과 같이 교차하는 임의의 선분이 있을 때, 교차점을 제외한 선분의 길이 중 가장 긴 선분의 길이를 구하여라.

 

왼쪽 그림은 6 x 6 크기의 지도에 4개의 선분이 서로 교차되어 있음을 표시 하고 있다.

오른쪽 그림은 교차점을 제외한 각 선분들의 길이를 나타내고 있으며, 그 중 가장 긴 선분의 길이는 2 임을 알 수 있다.

1000 X 1000 크기의 지도와, 임의의 여러 선분이 주어졌을 경우, 교차점을 제외한 선분의 길이 중 가장 긴 선분의 길이를 구하는 프로그램을 작성 하시오.

단, 각 선분의 두께는 항상 1이며, 선분들은 서로 수직 ( 90˚ ) 으로만 교차한다.

[구현 함수]

unsigned int run_test(int map[100][100])

map[100][100]: 지도 정보이다..

           1은 선분이 지나가는 곳을 나타내며, 0 은 아무것도 존재 하지 않는 곳이다.

Return value: 가장 긴 선분의 길이

[첨부 1 – single_id.cpp]

// DO NOT INCLUDE ANY FILES

#define SIZE 1000

 

int run_test(const char map[SIZE][SIZE])

{

    // WRITE YOUR CODES HEAR

 

    return 0; // 가장 긴 선분의 길이

}

 

 

 

 

 

 

 

 

[첨부 2 – main.cpp]

 

#include <stdio.h>

#include <stdlib.h>

 

#define SIZE 1000

 

static char map[10][SIZE][SIZE];

 

int run_test(const char map[SIZE][SIZE]);

 

void build_map(void)

{

    for (int c = 0; c < 10; c++)

    {

        for (int y = 0; y < SIZE; y++)

            for(int x = 0; x < SIZE; x++)

                map[c][x][y] = 0;

 

        for (int x = rand() % 10; x < SIZE; x += 2 + rand() % 8)

            for (int sy = rand() % SIZE, ey = rand() % SIZE; sy < ey; )

                map[c][x][sy++] = 1;

 

        for (int y = rand() % 10; y < SIZE; y += 2 + rand() % 8)

            for (int sx = rand() % SIZE, ex = rand() % SIZE; sx < ex; )

                map[c][sx++][y] = 1;

    }

}

 

void main(void)

{

    build_map();

 

    for (int count = 0; count < 10; count++)

        printf("%d ", run_test(map[count]));

}

 

 

 

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that   plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW    proficiency of your colleagues.      

 

Mobile R&D Office

SW Proficiency Buildup Dep.

[Problem] Write a C function which meets following conditions.

If there are some intersecting lines, find out the length of the longest line excluding intersections.  

 

A picture on the left shows four lines intersect in a map of size 6 x 6.   

A picture on the right shows the length of lines excluding intersections. You can see that the length of the longest line is 2.

Given a map of size 1000 X 1000 and various lines, write a C function which finds out the length of the longest line excluding intersections.

The thickness of lines is always 1, and lines cross/intersect each other at right angles (90˚).    

 [A function that you have to implement]   

unsigned int run_test(int map[100][100])

map[100][100]: map data

         1 indicates the place where lines pass

0 indicates the place where there is no line.

Return value: the length of the longest line  

[file 1 – single_id.cpp]

// DO NOT INCLUDE ANY FILES

#define SIZE 1000

 

int run_test(const char map[SIZE][SIZE])

{

    // WRITE YOUR CODES HEAR

 

    return 0; // the length of the longest line

}

 

 

 

 

 

 

 

 

 

[file 2 – main.cpp]

 

#include <stdio.h>

#include <stdlib.h>

 

#define SIZE 1000

 

static char map[10][SIZE][SIZE];

 

int run_test(const char map[SIZE][SIZE]);

 

void build_map(void)

{

    for (int c = 0; c < 10; c++)

    {

        for (int y = 0; y < SIZE; y++)

            for(int x = 0; x < SIZE; x++)

                map[c][x][y] = 0;

 

        for (int x = rand() % 10; x < SIZE; x += 2 + rand() % 8)

            for (int sy = rand() % SIZE, ey = rand() % SIZE; sy < ey; )

                map[c][x][sy++] = 1;

 

        for (int y = rand() % 10; y < SIZE; y += 2 + rand() % 8)

            for (int sx = rand() % SIZE, ex = rand() % SIZE; sx < ex; )

                map[c][sx++][y] = 1;

    }

}

 

void main(void)

{

    build_map();

 

    for (int count = 0; count < 10; count++)

        printf("%d ", run_test(map[count]));

}

 

 

 

 flatten(肯丰 2) 打不开

Generator

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that   plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW    proficiency of your colleagues.      

 

Mobile R&D Office

SW Proficiency Buildup Dep.

 

[Problem] Write a C function which meets following conditions. (Development time: 3 hours)

Assignment: Generator

 

There is a function, y = g(x).  

g(91)  = 91 + 9 + 1     = 101

g(100) = 100 + 1 + 0 + 0 =101

    g(101) = 101 + 1 + 0 + 1 = 103

We are going to call x as a generator of y in a function g(x). (A generator of 101 is 91, and a generator of 103 is 101.)

And, we are going to call a natural number which has no generator as a ‘self-number.’ (1, 3, 5, 7, 9, 20, 31, etc are ‘self-numbers.’)

In addition, we are going to call a natural number which has more than two generators (include two generators) as a ‘duplicate-number.’ (In case of 101, it is a ‘duplicate-number’ because there are two generators: 91 and 100.) 

 

Write a program which outputs following values.

ž   Every self-number between 1~5,000, inclusive. 

ž   Sum of all self-numbers between 1~5,000, inclusive.  

ž   The number of all duplicate-numbers between 1~5,000, inclusive.

ž   Every duplicate-number between 1~5,000, inclusive and a list of generators of each duplicate-number.

The output order of four items above does not matter. 

Output Example

 

gravity(肯丰)

 

보안 사항 필독

 

본 SW개발 역량검정 문제지는 출제 과정에서

많은 리소스가 투입된 당사의 지적 자산입니다.

 

향후 사내교육, 인력채용, 해외연구소 평가 등에

지속적으로 재사용 될 예정이므로, 출제 내용에

대해서 누설 및 자료 재전송을 절대 禁하며,

未 준수로 인한 유출 時 당사 정보보호규정의

위규사항 해당하므로 필히 숙지 바랍니다.

 

여러분 선배, 동료, 후배 연구원들의 성공적인

SW역량강화 추진을 위해 협조를 당부드립니다.

 

개발실 SW역량강화분과

 

 

[문제] 다음 조건을 만족하는 C언어 함수를 작성하라. (개발시간 4시간)

상자들이 쌓여있는 방이 있다. 그런데, 방이 오른쪽으로 90도 회전하여 상자들이 중력의 영향을 받아 낙하하게 되었다. 낙차가 가장 큰 상자를 구하여 그 낙차를 리턴 하는 함수를 작성하시오.

[예시]

위의 예에서는 총 7 + 4 + 2 + 6 + 7 = 26개의 상자가 있으며, 회전 후, 중력이 모든 상자에 작용하여 맨 오른쪽 방 그림의 상태가 된다. 이때 26개의 상자 중, A라는 표시가 있는 상자의 낙차가 7로 가장 크므로 7을 리턴 하면 된다.

참고로 B상자의 낙차는 6, C상자의 낙차는 1이다.

[제약사항]

어떠한 외부 라이브러리나 헤더파일도 사용할 수 없다.

중력은 회전이 완료된 후 적용된다.

상자들은 모두 한쪽 벽면에 붙여진 상태로 쌓여있어, 2차원 형태를 이루며, 벽에서 떨어져서 쌓인 상자는 없다.

해당 벽면의 가로길이는 항상 100이며, 세로길이도 항상 100이다.

-       즉, 상자는 최소 0, 최대 100 높이로 쌓을 수 있다.


 

[구현 함수]

int test_main(int data[100]);

 

int data[100] : 회전하기 전에 상자들이 쌓여있는 모양을 나타내는 data. 위의 예시에서는 {7,4,2,0,0,6,0,7,0} 이 된다. (예시라서 가로길이가 100이 아닌 9임에 주의)

return : 회전 및 중력 적용 후, 가장 낙차가 큰 상자의 낙차를 반환 (예시에서는 7)

 

[첨부 1 – 사번.cpp]

 

// DD NOT INCLUDE ANY FILES

int test_main(int data[100])

{

    return 0; //회전 및 중력 적용 후, 가장 낙차가 큰 상자의 낙차를 반환

}

 

 

[첨부 2 – main.cpp]

 

 

#include <stdio.h>

#include <stdlib.h>

 

int test_main(int data[100]);

 

void build_data(int data[100])

{

    for (int i = 0; i < 100; i++)

    {

        data[i] = rand() % 101;

    }

}

 

void main(void)

{

    int data[100];

 

    for (int l = 0; l < 10; l++)

    {

        build_data(data);

        printf("%d ", test_main(data));

    }

}

 

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that   plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes. 

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW    proficiency of your colleagues.      

 

Mobile R&D Office

SW Proficiency Buildup Dep.

 

[Problem] Write a C function which meets following conditions. (Development time: 4 hours)

There is a room where boxes are stacked. If a room is rotated 90 degrees to the right, boxes will fall, affected by gravity. Write a C function which finds out a box which will have the longest ‘fall distance’, and returns the value of the longest ‘fall distance.’ 

[Example] 

In the example above, there are 26 boxes in total (7 + 4 + 2 + 6 + 7 = 26). After rotating, gravity affects all boxes and final state becomes like the room on the right. Among these 26 boxes, a ‘fall distance’ of box A is the longest as 7, therefore, return 7.

For reference, a ‘fall distance’ of box B is 6, and a ‘fall distance’ of box C is 1. 

[Constraints]

Any external libraries or the header file cannot be used.  

Gravity begins to apply after rotation is finished. 

Boxes are stacked being adjacent to one side of the wall, thus all boxes are located in a two dimensional plane. There is no box which is stacked apart from the wall. The width of the wall is always 100, and the height of the wall is always 100. 

-       In other words, boxes can be stacked in the minimum 0 and maximum 100 heights.

 

[A function that you have to implement]  

 

int test_main(int data[100]);

 

int data[100] : data which shows shapes in which boxes are stacked before rotating. In the example above, it is {7,4,2,0,0,6,0,7,0}.

(Please note that the width of wall is 9 in the example above, not 100) 

return : return the value of ‘fall distance’ of the box which will have the longest ‘fall distance’ after rotating and being affected by gravity. (In the example above, return 7.)

 

[file 1 – your_ID_number.cpp] 

 

// DD NOT INCLUDE ANY FILES

int test_main(int data[100])

{

    return 0; //return a value of ‘fall head’ of the box which will have the largest ‘fall head’ after rotating and being affected by gravity.

}

 

 

[file 2 – main.cpp] 

 

 

#include <stdio.h>

#include <stdlib.h>

 

int test_main(int data[100]);

 

void build_data(int data[100])

{

    for (int i = 0; i < 100; i++)

    {

        data[i] = rand() % 101;

    }

}

 

void main(void)

{

    int data[100];

 

    for (int l = 0; l < 10; l++)

    {

        build_data(data);

        printf("%d ", test_main(data));

    }

}

 KSC Sort(肯丰)

 

보안 사항 필독

 

본 SW개발 역량검정 문제지는 출제 과정에서

많은 리소스가 투입된 당사의 지적 자산입니다.

 

향후 사내교육, 인력채용, 해외연구소 평가 등에

지속적으로 재사용 될 예정이므로, 출제 내용에

대해서 누설 및 자료 재전송을 절대 禁하며,

未 준수로 인한 유출 時 당사 정보보호규정의

위규사항 해당하므로 필히 숙지 바랍니다.

 

여러분 선배, 동료, 후배 연구원들의 성공적인

SW역량강화 추진을 위해 협조를 당부드립니다.

 

개발실 SW역량강화분과

 

 

[문제] 다음 조건을 만족하는 C언어 함수를 작성하라. (개발시간 4시간)

0부터 9,999까지 10,000개의 byte로 이루어진 배열 안에는 ASCII 문자와 한글 문자가 기록되어 있다.

1byte의 첫 비트가 0이면 해당 byte는 ASCII가 되며, 첫 비트가 1이 되면 다음 byte를 포함한 2byte는 한글이 된다.

한글의 경우, 첫 비트 1을 제외한 5비트는 초성, 그 다음 5비트는 중성, 그 다음 5비트는 종성을 의미한다. 

data안에 있는 10,000개의 byte를 다음의 기준으로 정렬하는 함수를 구현하시오.

기준)

ASCII, 한글 순으로 나열한다.

ASCII는 작은 것부터 큰 것 순으로 나열한다.

한글은 중성, 종성, 초성우선순위를 기준으로 작은 것부터 큰 것 순으로 나열한다.

) 0x55 0xAF 0x05 0x32 0xB2 0xA5 0x1B

# [0x55], [0x32], [0x1B]: ASCII

# [0xAF 0x05], [0xB2 0xA5]: 한글

[0xAF 0x05]: 1 01011 11000 00101, 초성(11), 중성(24), 종성(5)

[0xB2 0xA5]: 1 01100 10101 00101, 초성(12), 중성(21), 종성(5)

중성/종성/초성 순으로 정렬되기 때문에, 중성이 작은 B2 A5(중성 21), AF 05(중성 24) 순으로 정렬된다.

   소팅 결과: 0x1B, 0x32, 0x55, 0xB2, 0xA5, 0xAF, 0x05

      ASCII가 먼저 오고 이 후에 한글이 오며, ASCII/ 한글(중성/종성/초성 우선순위) 각각은 위 규칙에 의해 정렬된다.

void test_main(char data[SIZE]);

- data[SIZE] : 10,000개의 문자 데이터

[첨부 1 – 사번.cpp]

 

// DD NOT INCLUDE ANY FILES

 

#define SIZE (10000)

 

void test_main(char data[SIZE])

{

}

[첨부 2 – main.cpp]

 

 

#include <stdio.h>

#include <stdlib.h>

 

 

#define  SIZE  (10000)

 

 

void test_main(char data[SIZE]);

 

 

static char data[SIZE];

 

 

static void build_data(void)

{

    int a;

    for (a = 0; a < SIZE; a++)

        data[a] = rand() % 128;

    for (a = 0; a < SIZE / 2; a++)

        data[rand() % (SIZE - 1)] = rand() % 256;

}

 

 

void main(void)

{

    for (int l = 0; l < 10; l++)

    {

        build_data();

 

        test_main(data);

        int sum = 0;

        for (int a = 0; a < SIZE; a++)

        {

            sum = ((sum << 8) & 0xffffff00) + ((sum & 0xff000000) >> 24);

            sum += data[a];

        }

        printf("%08X ", sum);

    }

}

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that   plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW    proficiency of your colleagues.      

 

Mobile R&D Office

SW Proficiency Buildup Dep.

[Problem] Write a C function which meets following conditions. (Development time: 4 hours)

In an array composed of 10,000 bytes from 0 to 9,999, inclusive, ASCII characters and Korean characters are written. If the first bit of the first byte is ‘0’, that byte becomes ASCII, and if the first bit of the first byte is ‘1’, two bytes including the second byte becomes Korean characters. In case of Korean characters, five bits excluding the first bit ‘1’ mean an initial consonant, the next five bits mean a medial vowel, and the next five bits mean a final consonant.  

Write a C function which arranges 10,000 bytes in data according to the following standards.

Standards)  

Arrange characters in order of ASCII and Korean.

Arrange ASCII characters from the small one to the bigger one.

Arrange Korean characters from the small one to the bigger one, in order of priority: medial vowel-final consonant-initial consonant.   

Examples) 0x55 0xAF 0x05 0x32 0xB2 0xA5 0x1B

# [0x55], [0x32], [0x1B]: ASCII

# [0xAF 0x05], [0xB2 0xA5]: Korean Characters

[0xAF 0x05]: 1 01011 11000 00101, initial consonant (11), medial vowel (24), final consonant (5)

[0xB2 0xA5]: 1 01100 10101 00101, initial consonant (12), medial vowel (21), final consonant (5)

 Since they are arranged in order of priority: medial vowel-final consonant-initial consonant, B2 A5 (medial vowel: 21) comes first and AF 05 (medial vowel: 24) comes later. 

Results of sorting: 0x1B, 0x32, 0x55, 0xB2, 0xA5, 0xAF, 0x05

ASCII characters come first and then Korean characters come later. ASCII and Korean characters (in order of priority: medial vowel-final consonant-initial consonant) are arranged respectively, according to the standards above. 

void test_main(char data[SIZE]);   

- data[SIZE] : 10,000 char data   

[file 1 – single_id.cpp]   

 

// DD NOT INCLUDE ANY FILES

 

#define SIZE (10000)

 

void test_main(char data[SIZE])

{

}

 

[file 2 – main.cpp]

 

 

#include <stdio.h>

#include <stdlib.h>

 

 

#define  SIZE  (10000)

 

 

void test_main(char data[SIZE]);

 

 

static char data[SIZE];

 

 

static void build_data(void)

{

    int a;

    for (a = 0; a < SIZE; a++)

        data[a] = rand() % 128;

    for (a = 0; a < SIZE / 2; a++)

        data[rand() % (SIZE - 1)] = rand() % 256;

}

 

 

void main(void)

{

    for (int l = 0; l < 10; l++)

    {

        build_data();

 

        test_main(data);

        int sum = 0;

        for (int a = 0; a < SIZE; a++)

        {

            sum = ((sum << 8) & 0xffffff00) + ((sum & 0xff000000) >> 24);

            sum += data[a];

        }

        printf("%08X ", sum);

    }

}

 Loan(肯丰)

 

보안 사항 필독

 

본 SW개발 역량검정 문제지는 출제 과정에서

많은 리소스가 투입된 당사의 지적 자산입니다.

 

향후 사내교육, 인력채용, 해외연구소 평가 등에

지속적으로 재사용 될 예정이므로, 출제 내용에

대해서 누설 및 자료 재전송을 절대 禁하며,

未 준수로 인한 유출 時 당사 정보보호규정의

위규사항 해당하므로 필히 숙지 바랍니다.

 

여러분 선배, 동료, 후배 연구원들의 성공적인

SW역량강화 추진을 위해 협조를 당부드립니다.

 

개발실 SW역량강화분과

 

 

[문제] 다음 조건을 만족하는 C 프로그램을 작성하라. (개발시간 4시간)

최대 1,000명에게 장학금을 대출해 줄 수 있는 은행에 10,000명의 학생이 장학금 대출을 신청하였다.

신청한 모든 학생은 신용등급을 가지고 있으며, 신용등급은 최상위 AAA 단계에서 최하위 DDD 단계로 구분한다.

AAA > AAB > AAC > AAD > ABA > ABB > ABC > ABD > ACA > ACB > ACC > ACD > ADA > ADB > ADC > …

이 은행은 신용등급이 높은 순서로 장학금을 대출해 주려고 한다.

단, 대출 대상 학생이 1000명을 초과할 경우, 1000번째 학생이 포함된 등급의 모든 학생들에게는 대출을 하지 않는다.

예를 들어 BAC 등급까지 선정하면 991명, BAD 등급까지 선정하면 1003명일 경우, BAC 등급 까지만 장학금을 대출해 줄 수 있다. (총 991명 선정)

이 은행의 대출자 선정 인원을 계산하는 프로그램을 작성하라.

[구현 함수]

int test_main(int data[SIZE][3]);

data[10000][3] 은 10,000 명의 신용 등급 데이터 이다.

대출 대상자 인원수를 반환한다.

[첨부 1 – 사번.cpp]

 

// DD NOT INCLUDE ANY FILES

 

#define SIZE 10000

 

int test_main(int data[SIZE][3])

{

   return 0; // 대출 대상자 수

}

 

 

 

 

 

 

 

 

[첨부 2 – main.cpp]

 

#include <stdio.h>

#include <stdlib.h>

 

#define SIZE 10000

 

int test_main(int data[SIZE][3]);

 

static int data[SIZE][3];

 

static void build_data(void)

{

   for (int c = 0; c < SIZE; c++)

   {

      data[c][0] = 'A' + (rand() % 4);

      data[c][1] = 'A' + (rand() % 4);

      data[c][2] = 'A' + (rand() % 4);

   }

}

 

void main(void)

{

   for (int l = 0; l < 10; l++)

   {

      build_data();

 

      printf("%d ", test_main(data));

   }

}

 

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that   plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW    proficiency of your colleagues.      

 

Mobile R&D Office

SW Proficiency Buildup Dep.

 

[Problem] Write a C function which meets following conditions. (Development time: 4 hours)

10,000 students applied for student loans to the bank which can give loans to the maximum 1,000 students. All applicants have their own credit ratings, and credit ratings are classified from the highest rating AAA to the lowest rating DDD.

AAA > AAB > AAC > AAD > ABA > ABB > ABC > ABD > ACA > ACB > ACC > ACD > ADA > ADB > ADC > …

This bank wants to give loans to students in order of high credit ratings.  

However, if the applicants are more than 1000, the bank will not give loans to all applicants who have the same credit rating that the 1000th applicant has. 

For example, if the bank gives loans to the applicants having credit ratings from AAA to BAC, 991 students will get loans, and if the bank gives loans to the applicants having credit ratings from AAA to BAD, 1003 students will get loans. Therefore, the bank can give loans to the students having credit ratings from AAA to BAC.  

(991 students are selected in total.)  

Write a C function which calculates the number of students who are selected to get loans from this bank.

[A function that you have to implement] 

int test_main(int data[SIZE][3]; 

data[10000][3] data about credit ratings of 10,000 students.  

Return the number of students who are selected to get loans.  

[file 1 – ID number.cpp]

 

// DD NOT INCLUDE ANY FILES

 

#define SIZE 10000

 

int test_main(int data[SIZE][3])

{

   return 0; // the number of students who are selected to get loans

}

 

 

 

 

 

 

 

 

[file 2 – main.cpp]

 

#include <stdio.h>

#include <stdlib.h>

 

#define SIZE 10000

 

int test_main(int data[SIZE][3]);

 

static int data[SIZE][3];

 

static void build_data(void)

{

   for (int c = 0; c < SIZE; c++)

   {

      data[c][0] = 'A' + (rand() % 4);

      data[c][1] = 'A' + (rand() % 4);

      data[c][2] = 'A' + (rand() % 4);

   }

}

 

void main(void)

{

   for (int l = 0; l < 10; l++)

   {

      build_data();

 

      printf("%d ", test_main(data));

   }

}

 

 Mine(肯丰)

 

보안 사항 필독

 

SW개발 역량검정 문제지는 출제 과정에서

많은 리소스가 투입된 당사의 지적 자산입니다.

 

향후 사내교육, 인력채용, 해외연구소 평가 등에

지속적으로 재사용 될 예정이므로, 출제 내용에

대해서 누설 및 자료 재전송을 절대 禁하며,

未 준수로 인한 유출 時 당사 정보보호규정의

위규사항 해당하므로 필히 숙지 바랍니다.

 

여러분 선배, 동료, 후배 연구원들의 성공적인

SW역량강화 추진을 위해 협조를 당부드립니다.

 

개발실 SW역량강화분과

 

 

[문제] 다음 조건을 만족하는 C언어 함수를 작성하라. (개발시간 4시간)

지뢰가 밀집해 있는 지역에 폭탄을 투하하여 지뢰를 제거하는 작전을 펼치고자 한다.

폭탄을 투하하면 지뢰는 연쇄적으로 폭발하는데, 연쇄반응은 1초마다 상하좌우 네 방향으로 이어진다.

(대각선 지뢰는 터지지 않음)

특정 위치에 폭탄을 투하하고 10초 후에 몇 개의 지뢰가 남는지 반환하는 프로그램을 작성하시오.

(폭탄 투하 위치에 지뢰가 있을 수도 있고, 없을 수도 있으나 폭탄 투하 위치의 지뢰는 폭탄 투하와 동시에 제거됨)

 

[예시]

아래 그림은 지뢰가 밀집해 있는 지역을 나타낸다. (화살표가 폭탄 투하 위치임)

 

 

 

 

   

 

 

   

 

 
 

 

 

     

 

   

 

   

 

 

 

   

 

 

 

 

 

   

 

 

 

 

 

 

아래 그림은 폭탄 투하 후 1초가 경과된 모습이다. (1초 후에 15개 지뢰가 남음)

 

 

 

 

   

 

 

   

 

 
 

 

 

     

 

         

 

 

 

   

 

 

 

 

 

   

 

 

 

 

 

 

아래 그림은 2초 후 모습이다. (2초 후에 10개의 지뢰가 남음)

 

 

 

 

   

 

 

   

 

 
 

 

 

     

 

         

 

 

 

   

 

 

 

 

 

   

 

 

 

 

 

 

 

[제약사항]

어떠한 외부 라이브러리나 헤더파일도 사용할 수 없다. (#include <stdio.h> 등 사용 시 실격임)

 

[구현 함수]

unsigned int test_main(int map[100][100], unsigned int x, unsigned int y)

map[100][100]: 해당 지역은 가로 세로 각각 100 단위 면적이다.

           1 은 지뢰가 있는 곳이며, 0 은 아무 것도 없는 곳이다.

           Map [x 좌표][y 좌표] 의 순서로 좌표가 사용된다.

x : 폭탄 투하 x 좌표

y : 폭탄 투하 y 좌표

Return : 10초 후 터지지 않고 남아있는 지뢰의 수를 반환 (연쇄 폭발이 10회 일어난 후 남는 지뢰 수)

 

[첨부 1 – 사번.cpp]

 

// DD NOT INCLUDE ANY FILES

unsigned int test_main(int map[100][100], unsigned int x, unsigned int y)

{

    return 0;

}

 

[첨부 2 – main.cpp]

#include <stdlib.h>

#include <stdio.h>

 

 

unsigned int test_main(int map[100][100], unsigned int x, unsigned int y);

 

static void build_data(int map[100][100])

{

    for (int x = 0; x < 100; x++ )

        for( int y = 0; y < 100; y++ )

            map[x][y] = ((rand() % 3) != 0) ? 1 : 0;

}

 

 

void main(void)

{

    int map[100][100];

    for (int l = 0; l < 10; l++)

    {

        build_data(map);

        printf("%d ", test_main(map, rand() % 100, rand() % 100));

    }

}

 

 

 

 

 

 

 

 

 

 

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that   plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW    proficiency of your colleagues.      

 

Mobile R&D Office

SW Proficiency Buildup Dep.

 

[Problem] Write a C function which meets following conditions. (Development time: 4 hours)

An operation is going to be carried out in order to remove mines by dropping a bomb in the area where mines are densely packed. If a bomb is dropped, mines will be consecutively exploded, and this chain reaction will be continued every second to the four directions: front, back, left and right.  (The mines in the diagonal direction will not be exploded.)  

Write a C function which returns the number of remaining mines in 10 seconds after dropping a bomb to a specific place. (There could be a mine at the place where a bomb is dropped or there could be no mine there. The mine at the place where a bomb is dropped will be removed simultaneously with the bomb-dropping.)     

 

[Example]

The picture below shows the area in which mines are densely packed. (Arrow sign indicates the place where a bomb is dropped.)   

 

 

 

 

   

 

 

   

 

 
 

 

 

     

 

   

 

   

 

 

 

   

 

 

 

 

 

   

 

 

 

 

 

 

The picture below shows the state in one second after dropping a bomb. (15 mines will remain in one second.)

 

 

 

 

   

 

 

   

 

 
 

 

 

     

 

         

 

 

 

   

 

 

 

 

 

   

 

 

 

 

 

 

The picture below shows the state in two seconds after dropping a bomb. (10 mines will remain in two seconds.)

 

 

 

 

   

 

 

   

 

 
 

 

 

     

 

         

 

 

 

   

 

 

 

 

 

   

 

 

 

 

 

 

 

[Constraints]

Any external libraries or the header file cannot be used. (You will be failed if you use #include<stdio.h>, etc.)  

 

[A function that you have to implement]  

unsigned int test_main(int map[100][100], unsigned int x, unsigned int y) 

map[100][100]: The area has a size of the width of 100 units and the height of 100 units.  

              1 indicates the place where there is a mine, and 0 indicates the place where there is no mine.   

           Coordinates are used in order of Map [x-coordinate][y-coordinate].  

x : x-coordinate of the place where a bomb is dropped.  

y : y-coordinate of the place where a bomb is dropped.

Return: return the number of remaining mines not exploded in 10 seconds  

(The number of remaining mines after 10 consecutive explosions)

 

 

[file 1 – ID number.cpp]

 

// DD NOT INCLUDE ANY FILES

unsigned int test_main(int map[100][100], unsigned int x, unsigned int y)

{

    return 0;

}

 

[file 2 – main.cpp]

#include <stdlib.h>

#include <stdio.h>

 

 

unsigned int test_main(int map[100][100], unsigned int x, unsigned int y);

 

static void build_data(int map[100][100])

{

    for (int x = 0; x < 100; x++ )

        for( int y = 0; y < 100; y++ )

            map[x][y] = ((rand() % 3) != 0) ? 1 : 0;

}

 

 

void main(void)

{

    int map[100][100];

    for (int l = 0; l < 10; l++)

    {

        build_data(map);

        printf("%d ", test_main(map, rand() % 100, rand() % 100));

    }

}

 

 Mold(肯丰)

보안 사항 필독

 

SW개발 역량검정 문제지는 출제 과정에서

많은 리소스가 투입된 당사의 지적 자산입니다.

 

향후 사내교육, 인력채용, 해외연구소 평가 등에

지속적으로 재사용 될 예정이므로, 출제 내용에

대해서 누설 및 자료 재전송을 절대 禁하며,

未 준수로 인한 유출 時 당사 정보보호규정의

위규사항 해당하므로 필히 숙지 바랍니다.

 

여러분 선배, 동료, 후배 연구원들의 성공적인

SW역량강화 추진을 위해 협조를 당부드립니다.

 

개발실 SW역량강화분과

 

 

 

 

 

[문제] 다음 조건을 만족하는 C언어 함수를 작성하라.

식약청에서는 여름철 상온에서 X 곰팡이가 얼마나 빨리 증식하는지를 연구하고자, 현미경에 마이크로 카메라를 장착하여 X 곰팡이 개체를 조사하고자 한다.

촬영 데이터는 가로 1000, 세로 1000인 세포 배열로 표현되는데, 이 X 곰팡이는 나이에 따라 아래 그림과 같이  세포 한 개 개체부터 세포 네 개 개체까지 존재한다.

주어진 현미경 데이터를 분석하여, 데이터 내에 존재하는 X 곰팡이 개체 수를 반환하는 프로그램을 작성하라.

<< X 곰팡이의 8가지 현미경 패턴>>

아래의 11 X 11 샘플 배열 데이터에는 20개체의 X 곰팡이가 존재한다.

그리고 데이터 내에는 상기 표기된 8가지의 곰팡이 형태 이외에 변형 패턴은 존재하지 않는다. (노이즈 패턴 없음)

(X 곰팡이 개체는 가로 또는 세로 방향으로 세포가 인접한 경우가 없다)

 

 

 

[첨부 1 – single_id.cpp]

 

#define SIZE 1000

 

 

int run_test(const char data[SIZE][SIZE])

{

    return 0;

}

 

 

 

[첨부 2 – main.cpp]

 

#include <stdio.h>

#include <stdlib.h>

 

#define SIZE 1000

 

int run_test(const char data[SIZE][SIZE]);

 

 

static char data[10][SIZE][SIZE];

 

 

void build_data(void)

{

    static char virus[8][4][4] =

    {

        {{ 0, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 1, 0, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 0, 1, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }}

    };

 

    for (int l = 0; l < 10; l++)

    {

        for (int y = 0; y < SIZE; y++)

            for (int x = 0; x < SIZE; x++)

                data[l][x][y] = 0;

 

        for (int c = 0; c < SIZE * SIZE; c++)

        {

            int x = rand() % (SIZE - 4);

            int y = rand() % (SIZE - 4);

            int t = rand() % 8;

 

            for (int cy = 0; cy < 4; cy++)

                for (int cx = 0; cx < 4; cx++)

                    data[l][x + cx][y + cy] = virus[t][cx][cy];

        }

    }

}

 

 

void main(int argc, char* argv[])

{

    build_data();

 

    for (int c = 0; c < 10; c++)

        printf("%d ", run_test(data[c]));

}

 

 

 

 

 

 

 

 

 

 

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that   plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW    proficiency of your colleagues.      

 

Mobile R&D Office

SW Proficiency Buildup Dep.

 

 

[Problem] Write a C function which meets following conditions.

The Food & Drug Administration wants to examine each individual mold x by installing a micro camera in a microscope in order to find out how fast mold x increases in number at room temperature in summer.

The microphotograph data is expressed as an array of width 1000 and height 1000. This mold x increases in number from one to four individuals according to its age. Analyzing the given microphotograph data, write a C function which returns the number of mold x individuals which exist in the data.

<< 8 patters of mold X in a microphotograph>>

In the sample array data of size 11 x 11, there are 20 individuals of mold x. In addition, in the data, there are no other deformed patterns except for the eight patterns presented above. (There is no noise pattern.)

 (There is no case that each individual mold x is adjacent to cells of another individual in the horizontal and vertical direction.)

 

 

 

 

[file 1 – single_id.cpp]

 

#define SIZE 1000

 

 

int run_test(const char data[SIZE][SIZE])

{

    return 0;

}

 

 

[file 2 – main.cpp]

 

#include <stdio.h>

#include <stdlib.h>

 

#define SIZE 1000

 

int run_test(const char data[SIZE][SIZE]);

 

 

static char data[10][SIZE][SIZE];

 

 

void build_data(void)

{

    static char virus[8][4][4] =

    {

        {{ 0, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 1, 0, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 0, 1, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }},

        {{ 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }}

    };

 

    for (int l = 0; l < 10; l++)

    {

        for (int y = 0; y < SIZE; y++)

            for (int x = 0; x < SIZE; x++)

                data[l][x][y] = 0;

 

        for (int c = 0; c < SIZE * SIZE; c++)

        {

            int x = rand() % (SIZE - 4);

            int y = rand() % (SIZE - 4);

            int t = rand() % 8;

 

            for (int cy = 0; cy < 4; cy++)

                for (int cx = 0; cx < 4; cx++)

                    data[l][x + cx][y + cy] = virus[t][cx][cy];

        }

    }

}

 

 

void main(int argc, char* argv[])

{

    build_data();

 

    for (int c = 0; c < 10; c++)

        printf("%d ", run_test(data[c]));

}

 

 

 OX Pattern_ENG

 

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’ intellectual property devoted plenty of resources during the process.

In the future, this test could be reused for in-house training, recruitment, and evaluation for overseas research center.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s support for the successful promotion of SW proficiency to your colleagues.

 

Mobile R&D Office

 SW Proficiency Buildup Dep.

 

[Problem] Please write C program according to the following condition (Test time: 4hours, the use of #include is not permitted)

There is 10,000 integer array, data[], which is filled with ASCII capital letters ‘O’ and ‘X’.

Write a function that returns how many sequence in data[] are matched to the following pattern.

(two ‘O’, more than 1 ‘X’, two ‘O’, more than 1 ‘X’, and 1 ‘O’)

 

O, O, X, …, X, O, O, X, …, X, O

<X, …, X means: X should be more than one>

 

Condition)

Investigation of the pattern starts from the data[0].

Once ‘O’ or ‘X’ are recognized as the pattern, it is not reused in different pattern.

Ex) Two patterns exit in the following data (Underline part is excluded from the pattern count)

 O, O, X, O, O, X, O, O, X, O, O, X, O, O, X, O

  Ex) One pattern exits in the following data (Underline part is excluded from the pattern count)

   O, O, X, O, O, X, O, O, X, O, O, X, O

 

Example)

O, O, X, O, O, X, O

O, O, X, O, O, X, O, O, X, O, O, X, O

O, O, X, X, X, O, O, X, X, X, O

O, O, O, X, O, O, O, X, O

O, O, X, O, X, O, O, X, O, O, X, O, X

O, O, X, X, O, O, X, X, O, X, O, X, O, O, X, X, X, O, O, X, O, O, O, X, O, O, X, X, X, O

// Pattern : 1

// Pattern : 1

// Pattern : 1

// Pattern : 0

// Pattern : 1

// Pattern : 3

int test_main(int data[SIZE]);

- data[SIZE] : 10,000 integer array which has ‘O’s and ‘X’s

- return: pattern count

[Attachment 1 – Employee ID Number.cpp]

 

// DD NOT INCLUDE ANY FILES

 

int test_main(int data[10000])

{

    return 0;

}

 

[Attachment 2 – main.cpp]

 

 

#include <stdio.h>

#include <stdlib.h>

 

 

#define  SIZE 10000

 

 

int test_main(int data[SIZE]);

 

 

static int data[SIZE];

 

 

static void build_data(void)

{

    for (int a = 0; a < SIZE; a++)

    {

        data[a] = (rand() % 2) ? 'O' : 'X';

    }

}

 

 

void main(void)

{

    for (int l = 0; l < 10; l++)

    {

        build_data();

 

        printf("%d ", test_main(data));

    }

}

 robot(肯丰)

 

보안 사항 필독

 

SW개발 역량검정 문제지는 출제 과정에서

많은 리소스가 투입된 당사의 지적 자산입니다.

 

향후 사내교육, 인력채용, 해외연구소 평가 등에

지속적으로 재사용 될 예정이므로, 출제 내용에

대해서 누설 및 자료 재전송을 절대 禁하며,

未 준수로 인한 유출 時 당사 정보보호규정의

위규사항 해당하므로 필히 숙지 바랍니다.

 

여러분 선배, 동료, 후배 연구원들의 성공적인

SW역량강화 추진을 위해 협조를 당부드립니다.

 

개발실 SW역량강화분과

 

 

[문제] 다음 조건을 만족하는 C언어 함수를 작성하라. (개발시간 4시간)

사방이 벽으로 막혀 있는 100 x 100크기의 경기장에 파란 로봇과 빨간 로봇들이 배치되어 있다. 파란 로봇은 경기 시작 후 오른쪽 방향으로만 전진하며, 빨간 로봇은 왼쪽 방향으로만 전진한다. 각 로봇은 정수로 수치화된 공격력을 가지고 있는데, 파란 로봇의 공격력은 항상 홀수 이며, 빨간 로봇의 공격력은 항상 짝수이다. 그 역도 성립하는데, 홀수 공격력을 가지는 로봇은 반드시 파란색이며, 짝수 공격력을 가지는 로봇은 반드시 빨간색이다. 빨간색 로봇과 파란색 로봇이 충돌하게 되면 공격력이 낮은 로봇은 산화되어 없어진다(어떠한 흔적도 남기지 않으며 주변에 피해를 주지도 않는다) 로봇이 경기장 벽을 만나거나 더 이상 전진할 수 없으면 정지하게 된다. 모든 로봇이 산화되어 사라지거나 정지하면 경기가 종료된다. 경기 종료 후 남아 있는 로봇의 수를 리턴하는 함수를 작성하시오.

 

 

[예시]

아래는 경기장의 모습을 위에서 내려다 본 모습이다.

 

1열의 경우 파란 로봇과 빨간 로봇이 경기장 중간에서 충돌하여 공격력이 낮은 파란색 로봇이 산화되어 사라진다.

2열의 경우 빨간색 로봇과 파란색 로봇은 서로 만나지 않고 모두 살아 남는다.

3열의 경우 공격력 2의 빨간 로봇은 공격력 3의 파란 로봇에 의해 산화되며, 공격력 3의 파란 로봇은 공격력 4의 빨간 로봇에 의해 산화된다.

5열의 경우에서 알 수 있듯이 하나의 로봇이 복수의 로봇을 산화시키는 경우도 존재한다.

위 예시의 경우, 경기 종료 후 남아 있는 로봇의 개수는 빨간색 로봇 8기, 파란색 로봇 6기 이므로 8 + 6 = 14를 리턴하면 된다.

 

[제약사항]

어떠한 외부 라이브러리나 헤더파일도 사용할 수 없다. (#include <stdio.h> 등 사용 시 실격임)

main.cpp는 평가 시 변경되지 않는다.

로봇은 경기 시작과 동시에 일정한 속도로 움직이며, 모든 로봇의 이동속도는 동일하다.

경기장의 크기는 100 x 100크기로 주어진다. (예시에서는 설명을 위해 8 x 8로 주어졌음에 유의)

로봇의 공격력은 1이상 10이하로 주어진다.

공격력은 상대 로봇을 산화시킨 이후에도 변하지 않는다. 예를 들어 공격력 3인 빨간 로봇과 공격력 2인 파란 로봇이 충돌하면 파란 로봇은 산화되어 없어지지만 빨간 로봇은 3의 공격력을 그대로 유지한다.

[구현 함수]

int test_main(int map[100][100])

 

map[100][100] : 경기 시작 전, 경기장에 배치된 로봇들에 대한 정보가 주어진다.

0은 빈 공간, 그 외의 숫자는 해당 공격력을 가진 로봇이 그 위치에 있음을 나타낸다(공격력에 따라 색깔과 움직이는 방향이 결정됨에 주의)

map[x좌표][y좌표]의 순서로 좌표가 사용된다(x좌표가 먼저임에 주의)

예를 들어 map[5][3]의 값이 7이면 x좌표가 5이고 y좌표가 3인 곳에 7의 공격력을 가지는 파란 로봇이 있음을 의미하고 이 로봇은 오른쪽으로만 이동하므로, map[6][3]의 방향으로 움직인다.

return : 경기 종료 후 남아 있는 로봇의 수를 리턴

 

[첨부 1 – 사번.cpp]

// DO NOT INCLUDE ANY FILES

int test_main(int map[100][100])

{

    return 0;

}

 

[첨부 2 – main.cpp]

#include <stdio.h>

#include <stdlib.h>

 

int test_main(int map[100][100]);

 

static void build_data(int map[100][100])

{

    for (int x = 0; x < 100; x++)

    {

        for (int y = 0; y < 100; y++)

        {

            int r = rand() % 30;

            map[x][y] = r <= 10 ? r : 0;

        }

    }

}

 

void main(void)

{

    int map[100][100];

 

    for (int l = 0; l < 10; l++)

    {

        build_data(map);

        printf("%d ", test_main(map));

    }

}

 

 

 

 

 

 

 

 

Security Requirements

 

This SW Development Proficiency Test is Samsung Electronics’Intellectual Property that   plenty of resources are devoted to during the process of development.

In the future, this test will be reused for employee training, recruitment or evaluation of overseas research institutes.

The leakage and retransmission of the content is strictly forbidden. If there is any leakage of this confidential information, it is equivalent to the violation of our information protection policy.

We ask the entire participant’s cooperation for the successful promotion of SW    proficiency of your colleagues.      

 

Mobile R&D Office

SW Proficiency Buildup Dep.

 

 [Problem] Write a C function which meets following conditions. (Development time: 4 hours)

 

Blue robots and red robots are deployed in the playground of size 100 X 100 surrounded by walls in four directions. After a game gets started, blue robots move forward in the right direction, and red robots move forward in the left direction. Each robot has offensive capability which is digitized by integers. The offensive capability of blue robots is always an odd number, the offensive capability of red robots is always an even number, and a converse is true: the robots which have offensive capability of odd numbers are always blue robots, and the robots which have offensive capability of even numbers are always red robots. If a red robot and a blue robot collide with each other, the robot which has lower offensive capability will be burned and disappear. (This does not cause any damages to surroundings, leaving no traces.) If a robot reaches walls of the playground or cannot move forward anymore, it will stop moving. If all robots disappear or stop moving, a game will be over. Write a C function which returns the number of remaining robots after a game is over.    

 

[Example]

Below is a scene of the playground which is seen from above.

In line 1, a blue robot and a red robot collide with each other in the middle of the line 1 and the blue robot which has lower offensive capability is burned and disappears.

In line 2, a red robot and a blue robot do not meet each other, and all of them survive.

In line 3, a red robot which has offensive capability of 2 is burned by a blue robot which has offensive capability of 3, and it is burned by a red robot which has offensive capability of 4.

As we can see in line 5, there can be a case that one robot makes a number of robots burned.

In the example above, the number of remaining red robots is 8 and the number of remaining blue robots is 6, therefore, return 14 (8 + 6 = 14). 

 

[Constraints]         

Any external libraries or the header file cannot be used. (You will be failed if you use #include <stdio.h>,etc)

When evaluating your solution, main.cpp will not be changed. 

As soon as a game gets started, robots move at a constant speed, and the speed of all robots is identical.

The size of the playground is provided as 100 x 100. (In example above, the size is provided as 8 x 8, for explanation.)

Offensive capability of robots is from 1 to 10, inclusive.

Offensive capability does not change after burning other robots. For example, if a red robot which has offensive capability of 3 is collided with a blue robot which has offensive capability of 2, the blue robot is burned and disappears, but offensive capability of the red robot remains same. 

 

[A function that you have to implement]

int test_main(int map[100][100])

 

map[100][100] : Before starting a game, information about robots displayed in the playground is given.

0 indicates a vacant space, and the other numbers indicate that a robot having offensive capability of the relevant number is placed in the position of that number.

 (Please note that the offensive capability number determines the color of robot and the direction it moves.)

Coordinates are used in the order of map[x-coordinate][y-coordinate]. (Note that x-coordinate comes first.) 

For example, if a value of map[5][3] is 7, it means that a blue robot having offensive capability of 7 is at the place where x coordinate is 5 and y coordinate is 3, and as this robot moves forward in the right direction, it will move heading for map[6][3].

return : when a game is over, return the number of remaining robots. 

 

[file 1 – your_ID_number.cpp]

// DO NOT INCLUDE ANY FILES

int test_main(int map[100][100])

{

    return 0;

}

 

[file 2 – main.cpp]

#include <stdio.h>

#include <stdlib.h>

 

int test_main(int map[100][100]);

 

static void build_data(int map[100][100])

{

    for (int x = 0; x < 100; x++)

    {

        for (int y = 0; y < 100; y++)

        {

            int r = rand() % 30;

            map[x][y] = r <= 10 ? r : 0;

        }

    }

}

 

void main(void)

{

    int map[100][100];

 

    for (int l = 0; l < 10; l++)

    {

        build_data(map);

        printf("%d ", test_main(map));

    }

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

原文地址:https://www.cnblogs.com/ZzznOoooo/p/6628171.html