[알고리즘] 과제 안 내신 분..? - 백준 5597

se.jeon·2023년 3월 17일
0

알고리즘

목록 보기
20/21

문제

과정

알파벳 개수 세기와 동일한 방식으로 풀었다.

배열 자체를 카운팅 해 주는 방식이다.

결과

//
// Created by 전시은 on 2023/03/14.
//
// 문제 :: 과제 안 내신 분..?
// 링크 :: https://www.acmicpc.net/problem/5597
// 입력 :: 입력은 총 28줄로 각 제출자(학생)의 출석번호 n(1 ≤ n ≤ 30)가 한 줄에 하나씩 주어진다. 출석번호에 중복은 없다.
// 출력 :: 출력은 2줄이다. 1번째 줄엔 제출하지 않은 학생의 출석번호 중 가장 작은 것을 출력하고, 2번째 줄에선 그 다음 출석번호를 출력한다.

#include "../Problems.h"
#include <iostream>
#include <string>
using namespace std;

int nArray5597[31];

//int main()
int Solve5597()
{
    cout << "[디버깅용] Solve5597 :: 시작지점 >> \n";

    cin.tie(NULL);
    ios_base::sync_with_stdio(false);

    for(int i = 0; i < 28; i++)
    {
        int nInput;
        cin >> nInput;

        nArray5597[nInput]++;
    }

    for(int i = 0; i < 28; i++)
    {
        if(nArray5597[i + 1] == 0)
        {
            cout << i+1 << "\n";
        }
    }
    return 0;
}
profile
취미 다이소

0개의 댓글