WA的滋味

 HOJ 1474

 

How Many Fibs?

 

Time limit: 1sec. Submitted: 198
Memory limit: 32M Accepted: 65
Source : University of Ulm Internal Contest 2000

 

Recall the definition of the Fibonacci numbers:

f1 := 1
f2 := 2
fn := fn-1 + fn-2 (n >= 3)

Given two numbers a and b, calculate how many Fibonacci numbers are in the range [a, b].


Input

The input contains several test cases. Each test case consists of two non-negative integer numbers a and b. Input is terminated by a = b = 0. Otherwise, a <= b <= 10^100. The numbers a and b are given with no superfluous leading zeros.


Output

For each test case output on a single line the number of Fibonacci numbers fi with a <= fi <= b.

Sample Input

10 100
            1234567890 9876543210
            0 0
Sample Output
5
            4

这是个高精度加二分法查找的问题,不能说难,但也不简单(至少以我现在的水平看来)。我写高精度和二分法都很快写好了,但最终导致今天WA了几个小时却是因为我太不成熟,我对自己的代码也只是有个大概的印象,而不是精确的把握。遇到要分析细节的时候脑子不够冷静。

今天我算是尝透了WA的滋味,我拿着正确的程序,自己想各种各样变态的输入然后对比输出,发现差异后扎进代码里找BUG,好不容易改得和正确输出一样了,战战兢兢地交一遍,然后是无言的但沉重得像一座大山的Wrong Answer!捶过桌子之后抬起头还得再改。。。。。。

奋战了这么久,不过总算是AC了,但可笑的是我还得在心里大呼“Thank God!”,上天垂怜!.AC之后还得熬夜在这儿写着。。。

 

posted @ 2009-01-03 00:21  冰封的水  阅读(228)  评论(0编辑  收藏  举报