-
백준 1924번 _ 2007년 x월 y일은 무슨 요일? [C++]소프트웨어전공/알고리즘 문제풀이 2021. 9. 23. 18:28
[풀이 시도]
정말 쉬워보였는데, 막상 풀려니 결국 못풀었다..
문제에 있는 참고 정보에 따라 조건문을 나누는 식으로 31일, 30일 ,28일 이렇게 풀어내려고 했는데 그게 아니였음.
구글링으로 다양한 풀이들을 직접 따라해보면서 모르는 구현들을 줍줍하자..
구글에 c++ 1924로 검색해서 1페이지에 뜨는것 코드들을 순서대로 참고했다.
1. switch & case 조건문 활용
32줄 이하는 생략.
코드가 다소 길지만, 요일을 나누는게 직관적으로 보여서 따라 구현해보았다.
2. string 배열을 활용
'소프트웨어전공 > 알고리즘 문제풀이' 카테고리의 다른 글
백준 1152번 단어의 개수 _ [C++] (0) 2021.09.25 백준 1110번 더하기 사이클 [C++] (0) 2021.09.24 백준 2741번 _ C++ ( 시간초과 해결하기 ) (0) 2021.09.22 C++ 모두의 약수 ( 제한시간 1초 ) (0) 2021.09.21 C++ 모두의 약수 (0) 2021.09.21