I have seen that mostly great programmers use scanf in C++ while they can use cin with ios::sync_with_stdio(false); cin.tie(NULL); I want to know why??
Sorry because I don't know how to put things into a block .... Thanks in advance .....
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3773 |
3 | Radewoosh | 3646 |
4 | ecnerwala | 3624 |
5 | jqdai0815 | 3620 |
5 | Benq | 3620 |
7 | orzdevinwang | 3612 |
8 | Geothermal | 3569 |
8 | cnnfls_csy | 3569 |
10 | gyh20 | 3447 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | awoo | 161 |
2 | maomao90 | 160 |
3 | nor | 157 |
4 | atcoder_official | 156 |
4 | cry | 156 |
6 | -is-this-fft- | 155 |
7 | maroonrk | 154 |
8 | adamant | 153 |
9 | Um_nik | 151 |
10 | djm03178 | 146 |
I have seen that mostly great programmers use scanf in C++ while they can use cin with ios::sync_with_stdio(false); cin.tie(NULL); I want to know why??
Sorry because I don't know how to put things into a block .... Thanks in advance .....
Название |
---|
People use scanf because when the amount of test case are small the speed of scanf is still faster, but when the amount exceeds 1e7 cin overtakes scanf
cin is faster than scanf for large inputs? I did not know about that, can you provide some reference for that?
Reference
cin faster on 32-bit integers.
scanf / printf
more powerful thancin / cout
because it use regular expressions.And it's more helpful in debug when we need to print some debug information:
UPD: u can easy use scanf / printf in this problem, my solution with
scanf, printf, sprintf
A lot of what you mentioned can also be done with cin/cout, but sometimes it's a bit harder.![](/predownloaded/58/2d/582d63e97a42f5f28ffb258327ebe16c4b7eb023.png)
when you use sync_with_stdio you can no longer use some convenient and fast ways of input / output