ios::sync_with_stdio(false); ——> 在c++中之所以cin,cout效率低,是因为先把要输出的东西存入缓冲区,再输出,导致效率降低,而这段语句可以来打消iostream的输入和输出缓存,可节省时间,使效率与scanf与printf相差无几
cin.tie(0);
cout.tie(0);
总结:用了就不可以用scanf和printf,endl也不可以用。模板如下。
#include<bits/stdc++.h>
 using namespace std;
  #define endl '\n'
 int main(){
     ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
     return 0;
 }