답안 #2143

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
2143 2013-07-20T05:25:32 Z mhkim4886 생일수 I (GA4_birthday1) C++
컴파일 오류
0 ms 0 KB
#include <stdio.h>

typedef struct _Num
{
    int num;
    int total;
} Num;

int main()
{
    int out[101], n, qrear = 1, qtail = 1;
    Num queue[100001];
    scanf("%d", &n);

    for(int i = 1; i <= n; i++)
    {
        int k;
        scanf("%d", &k);

        qrear = 1; qtail = 1;
        queue[qtail++] = { 3, 3 };
        queue[qtail++] = { 5, 5 };
        queue[qtail++] = { 8, 8 };

        while(true)
        {
            int q = queue[qrear++].total;
            if(q == k)
            {
                out[i] = queue[qrear-1].num;
                break;
            }
            else
            {
                if(queue[qrear-1].total + 3 <= k) queue[qtail++] = { queue[qrear-1].num * 10 + 3, queue[qrear-1].total + 3 };
                if(queue[qrear-1].total + 5 <= k) queue[qtail++] = { queue[qrear-1].num * 10 + 5, queue[qrear-1].total + 5 };
                if(queue[qrear-1].total + 8 <= k) queue[qtail++] = { queue[qrear-1].num * 10 + 8, queue[qrear-1].total + 8 };
            }
        }
    }

    for(int i = 1; i <= n; i++) printf("%d\n", out[i]);
}

Compilation message

birthday1.cpp: In function 'int main()':
birthday1.cpp:21: error: expected primary-expression before '{' token
birthday1.cpp:21: error: expected `;' before '{' token
birthday1.cpp:22: error: expected primary-expression before '{' token
birthday1.cpp:22: error: expected `;' before '{' token
birthday1.cpp:23: error: expected primary-expression before '{' token
birthday1.cpp:23: error: expected `;' before '{' token
birthday1.cpp:35: error: expected primary-expression before '{' token
birthday1.cpp:35: error: expected `;' before '{' token
birthday1.cpp:36: error: expected primary-expression before '{' token
birthday1.cpp:36: error: expected `;' before '{' token
birthday1.cpp:37: error: expected primary-expression before '{' token
birthday1.cpp:37: error: expected `;' before '{' token