输出语句
输入语句有以下几种:
cin 和 cin.getline() 函数
scanf() 函数
getchar() 函数
gets() 函数(c++11后已禁用,使用可能导致 CE,但是 puts() 仍然可以使用)
输出语句有以下几种:
cout
printf() 函数
putchar() 函数
puts() 函数(仍然可以使用)
几种输入输出方式的效率:
getchar()/putchar() 略快于 gets()/puts()(输出字符串)。
getchar()/putchar() 快读快写略快与 scanf()/printf()。
scanf()/printf() 效率和优化后 cin/cout 差不多。
scanf()/printf() 速度远快于不加优化的 cin/cout。
综上:没必要非得快读,只要不用不加优化的 cin 就不用怕输入超时。
没了,我也讲不出来啥,大家不如去随便找个人问问了。