From 3954766b400a4f8bd13f04b4542fe0e7eaf2611d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=9C=A0=ED=99=98?= Date: Thu, 9 Oct 2025 11:24:56 +0900 Subject: [PATCH 1/2] =?UTF-8?q?2064=EB=B2=88=20=ED=92=80=EC=9D=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Appendix C/solutions/2064.cpp | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/Appendix C/solutions/2064.cpp b/Appendix C/solutions/2064.cpp index 6c991660..a72745a3 100644 --- a/Appendix C/solutions/2064.cpp +++ b/Appendix C/solutions/2064.cpp @@ -1,11 +1,34 @@ -// Authored by : BaaaaaaaaaaarkingDog +// Authored by : uhwan0723 // Co-authored by : - -// http://boj.kr/**************** +http://boj.kr/7537647dfa6d4aeabf0599060c0c1c3f #include using namespace std; +int n, bytes[4]; +unsigned int mask, mx = 0, mn = 0xFFFFFFFF; + +void print(unsigned int addr){ + for(int i = 0; i < 4; ++i) + bytes[i] = (addr >> i*8) & ((1 << 8) - 1); + printf("%d.%d.%d.%d\n", bytes[3], bytes[2], bytes[1], bytes[0]); +} + int main(void){ - ios::sync_with_stdio(0); - cin.tie(0); - -} \ No newline at end of file + scanf("%d", &n); + while(n--){ + scanf("%d.%d.%d.%d", bytes+3, bytes+2, bytes+1, bytes); + unsigned int ip = 0; + for(int i = 0; i < 4; ++i) + ip |= (bytes[i] << i*8); + mx = max(mx, ip); + mn = min(mn, ip); + } + mask = ~(mx ^ mn); + for(int i = 31; i >= 0; --i){ + if(((mask >> i) & 1) == 1) continue; + mask = (mask >> i) << i; + break; + } + print(mx & mask); + print(mask); +} From 74f643d9c2cb1cbe1e334eca3d55f4ecbe2ad303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=9C=A0=ED=99=98?= Date: Thu, 9 Oct 2025 11:26:43 +0900 Subject: [PATCH 2/2] =?UTF-8?q?//=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Appendix C/solutions/2064.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Appendix C/solutions/2064.cpp b/Appendix C/solutions/2064.cpp index a72745a3..9250e415 100644 --- a/Appendix C/solutions/2064.cpp +++ b/Appendix C/solutions/2064.cpp @@ -1,6 +1,6 @@ // Authored by : uhwan0723 // Co-authored by : - -http://boj.kr/7537647dfa6d4aeabf0599060c0c1c3f +// http://boj.kr/7537647dfa6d4aeabf0599060c0c1c3f #include using namespace std;