Thank's for your help. I've modified my code as you guys suggested
Especially little joey, I really appreciate your suggestions, they made me calm and rethought about my programming skill, instead of just being panic about failing the test....
I use the testcase provided by Mr.NightZ-1 in artical "193 WA why? What's wrong in my algorithm??????". However, I got a strange answer diffenent from the one provided by Mr.sohel in some cases...