如何提高cin的读取效率
在主函数下加入一句 ios::sync_with_stdio(false);
在代码中加入这句语句可以提高cin读入数据的速度,使得cin读入数据的能力和scanf相当
int main() {
int n;
ios::sync_with_stdio(false);
cin>>n;
....
}
在主函数下加入一句 ios::sync_with_stdio(false);
在代码中加入这句语句可以提高cin读入数据的速度,使得cin读入数据的能力和scanf相当
int main() {
int n;
ios::sync_with_stdio(false);
cin>>n;
....
}