https://github.com/doorcs/algorithm
Baekjoon Online Judge && LeetCode && Programmers
https://github.com/doorcs/algorithm
cpp cpp17 cpp20 problem-solving
Last synced: over 1 year ago
JSON representation
Baekjoon Online Judge && LeetCode && Programmers
- Host: GitHub
- URL: https://github.com/doorcs/algorithm
- Owner: doorcs
- Created: 2024-01-26T07:27:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T10:59:07.000Z (over 1 year ago)
- Last Synced: 2024-10-29T12:48:36.373Z (over 1 year ago)
- Topics: cpp, cpp17, cpp20, problem-solving
- Language: C++
- Homepage:
- Size: 373 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
언젠가 고쳤던 좋지 않은 습관들 ( toggle )
- 줄바꿈이 필요할 땐 `std::endl` 대신 `'\n'` 쓰기
- `std::cin.tie(nullptr)->ios_base::sync_with_stdio(false);` 처럼 쓰지 말고 분리해서 쓰기
> `cin.tie(nullptr);`
> `cout.tie(nullptr);`
> `ios_base::sync_with_stdio(false);`
- `for`, `while` 같은 제어문 키워드와 조건식 괄호 사이는 한 칸 띄우기
> `for(;;)` // bad
>
> `for (;;)` // good!
- `if`, `else if`, `else` 구문 정렬하기 - `closing brace on new line, else on same line`
> if (cond) {
>
> `} else if (cond) {` // good!
>
> } else {}
- - -
- 2024.05 - 구글 C++ 스타일가이드를 따르려 노력하되, 의도적으로 무시할 부분들을 정하기 ( 문제 해결에 초점을 맞추기 )
- 네임스페이스를 전부 가져오는 것을 권장하지 않지만, 코드 작성 편의성을 위해 `using namespace std;` 쓰기
- 여러 문장을 한 줄에 작성하는 것을 권장하지 않지만, `int N; cin >> N;` 정도는 한줄로 작성하기
- 2024.06 - 전처리문과 다른 코드들 사이를 한 줄 띄우기, indentation을 `4 spaces` 에서 `2 spaces` 로 줄이기
- 2024.07 - 클래스의 `operator<` 에는 반드시 ***const*** 붙여주기, `std::stack` 대신 `std::vector` 쓰기 ( 더 편하다! )
- bool operator<(const ~~*Classname*~~& other) ***const*** {
- `stk.push() == vec.push_back()` | `stk.pop() == vec.pop_back()` | `stk.top() == vec.back()`
- 2024.08 - 숫자가 조금이라도 커질 것 같으면 long long 자료형 사용하기!!! *( `using ll = long long;` )*
- 2024.09 - `std::deque`를 사용할 때, 실제로 reverse 연산을 수행하는 대신 `flag` 쓰기
- ~~reverse(dq.begin(), dq.end());~~ // bad
- `bool rev = true;` // good!