프로그래밍 언어/C++

ios_base::sync_with_stdio(false); cin.tie(nullptr);

가든_ 2023. 6. 9. 16:43

c++을 사용하여 알고리즘 풀 때 시간초과나면 아래의 코드로 해결 가능 할 수 있다.

	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

원리

ios_base::sync_with_stdio(false);

- c와 c++의 버퍼를 분리시킴

- c++만의 독립적인 버퍼로 코드를 실행시켜 실행 속도를 빠르게 한다

cin.tie(nullptr);

- cout과 cin의 묶음을 풀어준다.