— 해당 페이지는 각 조원 당 백준 등의 온라인 저지에서 문제 중 하나를 선정하여 모두 다음 모임까지 푼 뒤, 코드 리뷰를 하는 활동의 기록 페이지입니다. 1주차는 시간 상의 이유로 불가피하게 하지 못했지만, 이번 주차 이후로 모든 주차에 올려질 예정입니다.

  1. 9655번 돌 게임
// 이예고운
#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    if (n % 2 == 1) {
        printf("SK\\n");
    }
    else {
        printf("CY\\n");
    }
    return 0;
}

// 신서윤
#include<stdio.h>

int main() {
    int num;
    scanf("%d", &num);

    if (num % 2 == 0) {
        printf("CY");
    }
    else {
        printf("SK");
    }

    return 0;
}

// 정재훈
#include <stdio.h>

int main(void)
{
    int a;
    scanf("%d", &a);
    printf("%s", (a % 2) == 0 ? "CY" : "SK");
}
  1. 31923번 마라탕후루
// 이예고운
#include <stdio.h>
#include <stdlib.h>

int main() {
    int n, p, q;
    scanf("%d %d %d", &n, &p, &q);
    int strawberry[100], shine_muscat[100];
    for (int i = 0; i < n; i++) {
        scanf("%d", &strawberry[i]);
    }
    for (int i = 0; i < n; i++) {
        scanf("%d", &shine_muscat[i]);
    }

    int result[100];
    for (int i = 0; i < n; i++) {
        int a = strawberry[i];
        int b = shine_muscat[i];
        int count = 0;
        while (a != b) {
            a += p;
            b += q;
            ++count;
            if (count == 10000) {
                printf("NO\\n");
                return 0;
            }
        }
        result[i] = count;
    }

    printf("YES\\n");
    for (int i = 0; i < n; i++) {
        printf("%d ", result[i]);
    }
    return 0;
}

// 신서윤
#include<stdio.h>

int main() {
    int num, str, shy, index, minus;
    scanf("%d %d %d", &num, &str, &shy);
    int strcc[100];
    int shycc[100];
    for (int i = 0; i < num; i++) {
        scanf("%d", &strcc[i]);
    }
    for (int i = 0; i < num; i++) {
        scanf("%d", &shycc[i]);
    }

    if (str - shy > 0) {
        minus = str - shy;
        for (int i = 0; i < num; i++) {
            if (shycc[i] - strcc[i] < 0) {
                printf("NO\\n");
                return 0;
            }
            if ((shycc[i] - strcc[i]) % minus != 0) {
                printf("NO\\n");
                return 0;
            }

        }
        printf("YES\\n");
        for (int i = 0; i < num; i++) {
            printf("%d ", (shycc[i] - strcc[i]) / minus);
        }
    }
    else if (str - shy < 0) {
        minus = shy - str;
        for (int i = 0; i < num; i++) {
            if (strcc[i] - shycc[i] < 0) {
                printf("NO\\n");
                return 0;
            }
            if ((strcc[i] - shycc[i]) % minus != 0) {
                printf("NO\\n");
                return 0;
            }

        }
        printf("YES\\n");
        for (int i = 0; i < num; i++) {
            printf("%d ", (strcc[i] - shycc[i]) / minus);
        }
    }
    else {
        minus = 0;
        for (int i = 0; i < num; i++) {
            if (strcc[i] - shycc[i] != 0) {
                printf("NO\\n");
                return 0;
            }

        }
        printf("YES\\n");
        for (int i = 0; i < num; i++) {
            printf("0 ");
        }
    }

    return 0;
}

// 정재훈
#include <stdio.h>
int strob[100];
int shain[100];
int answer[100];

int main(void)
{
    int n, p, q;
    scanf("%d %d %d", &n, &p, &q);
    for (size_t i = 0; i < n; i++)
    {
        scanf("%d", &strob[i]);
    }
    for (size_t i = 0; i < n; i++)
    {
        scanf("%d", &shain[i]);
    }
    for (size_t i = 0; i < n; i++)
    {
        int j = 0;
        int chai = strob[i]-shain[i];
        while (j <= 10000)
        {
            if (chai == 0)
            {
                answer[i] = j;
                break;
            }else{
                chai = chai + p - q;
            }
            j++;
        }
        if(j > 10000){
            printf("NO");
            return 0;
        }
        
        
        
    }
    printf("YES\\n");
    for (size_t i = 0; i < n; i++)
    {
        printf("%d ", answer[i]);
    }
}
  1. 29754번 세상에는 많은 유튜버가 있고, 그중에서 버츄얼 유튜버도 존재한다
// 이예고운
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_YOUTUBERS 100
#define MAX_WEEKS 52

typedef struct {
    char name[21];
    int weekly_broadcasts[MAX_WEEKS]; // 각 주의 방송 시간 합계 (분 단위)
    int weekly_counts[MAX_WEEKS]; // 각 주의 방송 횟수
    int total_broadcast_time; // 총 방송 시간 (분 단위)
} Youtuber;

Youtuber youtubers[MAX_YOUTUBERS];
int youtuber_count = 0;

// 유튜버 이름으로 인덱스를 찾는 함수
int find_youtuber_index(const char* name) {
    for (int i = 0; i < youtuber_count; i++) {
        if (strcmp(youtubers[i].name, name) == 0) {
            return i;
        }
    }
    return -1;
}

// 시간 차이를 분 단위로 계산하는 함수
int calculate_minutes(const char* start, const char* end) {
    int sh, sm, eh, em;
    sscanf(start, "%d:%d", &sh, &sm);
    sscanf(end, "%d:%d", &eh, &em);
    return (eh * 60 + em) - (sh * 60 + sm);
}

// 이름 비교 함수
int compare_names(const void* a, const void* b) {
    return strcmp((const char*)a, (const char*)b);
}

int main() {
    int n, m;
    scanf("%d %d", &n, &m);

    for (int i = 0; i < n; i++) {
        char name[21], start[6], end[6];
        int day;
        scanf("%s %d %s %s", name, &day, start, end);

        int minutes = calculate_minutes(start, end);

        int index = find_youtuber_index(name);
        if (index == -1) {
            index = youtuber_count++;
            strcpy(youtubers[index].name, name);
            memset(youtubers[index].weekly_broadcasts, 0, sizeof(youtubers[index].weekly_broadcasts)); // 구조체 초기화
            memset(youtubers[index].weekly_counts, 0, sizeof(youtubers[index].weekly_counts));
            youtubers[index].total_broadcast_time = 0;
        }

        int week = (day - 1) / 7;
        youtubers[index].weekly_broadcasts[week] += minutes;
        youtubers[index].weekly_counts[week]++;
        youtubers[index].total_broadcast_time += minutes;
    }

    // 진짜 버츄얼 유튜버들을 찾고 이름을 저장할 배열
    char real_youtubers[MAX_YOUTUBERS][21];
    int real_count = 0;

    for (int i = 0; i < youtuber_count; i++) {
        int valid_weeks = 0;
        for (int j = 0; j < (m / 7); j++) {
            if (youtubers[i].weekly_counts[j] >= 5 && youtubers[i].weekly_broadcasts[j] >= 60 * 60) {
                valid_weeks++;
            }
        }

        if (valid_weeks > 0) {
            strcpy(real_youtubers[real_count++], youtubers[i].name);
        }
    }

    if (real_count == 0) {
        printf("-1\\n");
    }
    else {
        qsort(real_youtubers, real_count, sizeof(real_youtubers[0]), compare_names);
        for (int i = 0; i < real_count; i++) {
            printf("%s\\n", real_youtubers[i]);
        }
    }

    return 0;
}
// 신서윤
#include<stdio.h>
#include<string.h>

typedef struct ver_ {
    char name[21];
    int hh;
    int mm;
    int number;
    int dday;
    char yn;
}Ver;

int main() {
    int N, M;
    scanf("%d %d", &N, &M);

    Ver arr[100];
    int people = 0;
    char p_name[21];
    int day;
    char start[6], end[6];
    int index;
    int hour, mi;
    

    for (int i = 0; i < N; i++) {
        arr[i].hh = 0, arr[i].mm = 0, arr[i].number = 0, arr[i].yn='Y';
        scanf("%s %d %s %s", &p_name, &day, &start, &end);
        if (i==0) {
            strcpy(arr[people].name, p_name);
            people += 1;
            index = i;
        }
        for (int j = 0; j < people; j++) {
            if (strcmp(p_name, arr[j].name) == 0) {
                index = j;
                break;
            }
            else if (j == people - 1) {
                strcpy(arr[people].name, p_name);
                people += 1;
                index = j;
            }
        }

        //여기가 문제 / 7일과 8일 사이 차이를 찾아야 함
        if ((day / 7) - (arr[index].dday / 7) == 1 && ) {
            if (arr[index].number >= 5 && arr[index].hh >= 60) {
                arr[index].number = 0;
                arr[index].hh = 0;
                arr[index].mm = 0;
            }
            else{
                arr[index].yn = 'N';
            }
        }

        
        char* hs = strtok(start, ":");
        char* ms = strtok(NULL, ":");
        char* he = strtok(end, ":");
        char* me = strtok(NULL, ":");
        
        
        hour = ((int)*(he)-(int)*hs) * 10 + (int)*(he+1) - (int)*(hs+1);
        mi = ((int)*(me)-(int)*ms) * 10 + (int)*(me + 1) - (int)*(ms + 1);

        printf("%d %d\\n", hour, mi);

        if (mi < 0) {
            hour -= 1;
            mi += 60;
        }
        arr[index].hh += hour;
        arr[index].mm += mi;
        if (arr[index].mm >= 60) {
            arr[index].hh += 1;
            arr[index].mm -= 60;
        }
        arr[index].number += 1;
        arr[index].dday = day;

    }

    for (int i = 0; i < people; i++) {
        if (arr[i].yn == 'Y') {
            printf("%s\\n", arr[i].name);
        }
    }

    return 0;
}
# 정재훈
from collections import defaultdict
from datetime import datetime, timedelta

def calc_dur(s, e):
    FMT = '%H:%M'
    return datetime.strptime(e, FMT) - datetime.strptime(s, FMT)

n, m = map(int, input().split())

yt_times = defaultdict(lambda: defaultdict(timedelta))

for _ in range(n):
    entry = input().strip()
    name, day, start, end = entry.split()
    day = int(day)
    duration = calc_dur(start, end)
    yt_times[name][day] += duration

yt_sum = {}

for name, days in yt_times.items():
    total_dur = sum(days.values(), timedelta())
    total_hrs = total_dur.total_seconds() / 3600
    days_count = len(days)
    yt_sum[name] = (total_hrs, days_count)

real_yt = [name for name, (hrs, days) in yt_sum.items() if hrs >= 60 and days >= 5]

real_yt.sort()

if real_yt:
    for yt in real_yt:
        print(yt)
else:
    print(-1)