본문 바로가기

C++

[C++] cin,cout,endl 계산속도 올리기(시간 초과 해결)

std::endl은 \n보다 느리다.

endl는 개행하는 것과 동시에 내부 버퍼를 비우는 역할을 하기 때문에 

시간 초과가 난다면 endl 보다 \n을 이용해보자.

 

ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

cin과 cout계산 속도 높여주는 코드