From 34b335f3665be9275cbdad05efb7f026dedf7328 Mon Sep 17 00:00:00 2001 From: yenru0 Date: Sat, 6 Jul 2024 21:50:00 +0900 Subject: [PATCH] complete 1783.c --- zeta_C/completed/1783.c | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 zeta_C/completed/1783.c diff --git a/zeta_C/completed/1783.c b/zeta_C/completed/1783.c new file mode 100644 index 0000000..5cad880 --- /dev/null +++ b/zeta_C/completed/1783.c @@ -0,0 +1,56 @@ +#include +#include +#include +// M 개수에 주요한 변수를 가지고 있음. N = 1이면 무조건 1 +// 1 1 1 1 1 +// 1 1 1 1 1 +int sick_knight(int N, int M) { + if (N == 1) { + return 1; + } else if (M == 1) { + return 1; + } else if (M == 2) { + if (N < 3) { + return 1; + } else { + return 2; + } + } else if (M == 3) { + if (N < 3) { + return 2; + } else { + return 3; + } + } else if (M == 4) { + if (N < 3) { + return 2; + } else { + return 4; + } + } else if (M == 5) { + if (N < 3) { + return 3; + } else { + return 4; + } + } else if (M == 6) { + if (N < 3) { + return 3; + } else { + return 4; + } + } else if (M >= 7) { + if (N < 3) { + return 4; + } else { + return M - 2; + } + } +} + +int main() { + int N, M; + scanf("%d %d", &N, &M); + printf("%d\n", sick_knight(N, M)); + return 0; +} \ No newline at end of file