ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1027. D++ Again

Why 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!!