|
|
back to boardWhy read text with std::getc got AC 0.001s and fread got AC 0.015s for C++ compilers ???? Posted by c_pp 15 Dec 2016 00:14 char s[16384] ; unsigned n = 0; // AC 0.001s with this code. for(int c = std::getc(stdin); c != EOF; c = std::getc(stdin)) s[n++] = c; // and AC 0.015s with n = fread(s,1,sizeof(s)-1,stdin); code. // I'm wonder that the std::getc faster than fread!! |
|
|