|  | 
|  | 
| back to board | Hint for C++ programmers Posted by HELLER  8 Apr 2002 19:58I've solved 1102 using DFA and reading 1 char each cycle withscanf("%c",&c); - and I've got Time Limit
 then I've tried c=getc(stdin); - and my program worked for 1.1 second.
 May be it will help.
What's DFA , Please discribe it clearly Posted by XueMao  20 Jul 2002 19:21Re: Hint for C++ programmers Posted by Bonny  15 May 2004 23:30Thanks!! I've got accepted because of your getc() function.Re: Hint for C++ programmers Yes! I got the same problem - now AC!No subject I also thank you ;)Re: Hint for C++ programmers Me too ... thanks.I got time limit with scanf but with getc(stdin) i got accepted in 0.484 sec. Nice problem :D.
Re: Hint for C++ programmers Posted by div  4 Oct 2006 02:27Another hint:if you are using '%' operator in your code, use subtraction instead of it (if you can).
 For example, code
 x = (x + 1) % MAX;
 got TLE,
 
 whereas
 x++;
 if (x >= MAXL) x -= MAXL;
 got AC 0.5
 good luck
Re: Hint for C++ programmers I still don't understand,,, is first test so large that I could get TLE? Or it's actually some technical problem?? | 
 | 
|