Can anyone explain what is wrong with my code. I tried to find the position of ith power of 2 which will be the element of Fibonacci number left after process end still I am getting wrong answer verdict this is link to my solution CodeChef: Practical coding for everyone
It fails on the testcase
1
64
(the answer should be 2
, but on my machine, yours gives 3
).
Horrible Rounding off errors at work!
See how this doesnāt work, even though I built the log function myself: CodeChef: Practical coding for everyone
And how this clever workaround works: CodeChef: Practical coding for everyone
Very disappointed that built in log doesnāt work even in case of python
Use log2l()
function instead of log2()
.
I was stuck here too xD.
Use log2l instead
Bruh wtf (20char)
Can anyone point out my mistake. Itās working properly for smaller constraints but showing wrong ans for larger constraints.
https://www.codechef.com/viewsolution/26642928
Like many solutions, it fails on the testcase:
1
18014398509481984
presumably due to your use of pow
.
Thank you, really helped.
When I was using pow() it was showing correct result in the code blocks.
It was creating problem only when I was submitting in the code chef.
Can anyone tell me whats wrong with my solution getting 20pts.https://www.codechef.com/viewsolution/26645366
Its because of using pow() funcn.
Check whether it works for the following case:
1
18014398509481984
why the answer will be 2 ?
Initial D:
0 1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0 1 1 2
New D:
1 2 5 3 4 9 3 0 7 1 6 7 5 8 9 9 8 5 7 6 1 7 0 3 9 4 3 5 2 1 1 2
New D:
2 3 9 0 1 7 8 9 5 6 7 3 4 5 1 2
New D:
3 0 7 9 6 3 5 2
New D:
0 9 3 2
New D:
9 2
New D:
2
solutionBruteForce: 2
Sir at n=64 where n is the number of index starting from 1
we get Fibonacci number at n=64 as 10610209857723 so its mod by 10 will give 3 ?
please help!
Iām just following the instructions in the Problem Statement:
Initial D:
FN_0%10 = 0 , FN_1%10 = 1 , FN_2%10 = 1 , FN_3%10 = 2 , FN_4%10 = 3 , FN_5%10 = 5 , FN_6%10 = 8 , FN_7%10 = 3 , FN_8%10 = 1 , FN_9%10 = 4 , FN_10%10 = 5 , FN_11%10 = 9 , FN_12%10 = 4 , FN_13%10 = 3 , FN_14%10 = 7 , FN_15%10 = 0 , FN_16%10 = 7 , FN_17%10 = 7 , FN_18%10 = 4 , FN_19%10 = 1 , FN_20%10 = 5 , FN_21%10 = 6 , FN_22%10 = 1 , FN_23%10 = 7 , FN_24%10 = 8 , FN_25%10 = 5 , FN_26%10 = 3 , FN_27%10 = 8 , FN_28%10 = 1 , FN_29%10 = 9 , FN_30%10 = 0 , FN_31%10 = 9 , FN_32%10 = 9 , FN_33%10 = 8 , FN_34%10 = 7 , FN_35%10 = 5 , FN_36%10 = 2 , FN_37%10 = 7 , FN_38%10 = 9 , FN_39%10 = 6 , FN_40%10 = 5 , FN_41%10 = 1 , FN_42%10 = 6 , FN_43%10 = 7 , FN_44%10 = 3 , FN_45%10 = 0 , FN_46%10 = 3 , FN_47%10 = 3 , FN_48%10 = 6 , FN_49%10 = 9 , FN_50%10 = 5 , FN_51%10 = 4 , FN_52%10 = 9 , FN_53%10 = 3 , FN_54%10 = 2 , FN_55%10 = 5 , FN_56%10 = 7 , FN_57%10 = 2 , FN_58%10 = 9 , FN_59%10 = 1 , FN_60%10 = 0 , FN_61%10 = 1 , FN_62%10 = 1 , FN_63%10 = 2
New D:
FN_1%10 = 1 , FN_3%10 = 2 , FN_5%10 = 5 , FN_7%10 = 3 , FN_9%10 = 4 , FN_11%10 = 9 , FN_13%10 = 3 , FN_15%10 = 0 , FN_17%10 = 7 , FN_19%10 = 1 , FN_21%10 = 6 , FN_23%10 = 7 , FN_25%10 = 5 , FN_27%10 = 8 , FN_29%10 = 9 , FN_31%10 = 9 , FN_33%10 = 8 , FN_35%10 = 5 , FN_37%10 = 7 , FN_39%10 = 6 , FN_41%10 = 1 , FN_43%10 = 7 , FN_45%10 = 0 , FN_47%10 = 3 , FN_49%10 = 9 , FN_51%10 = 4 , FN_53%10 = 3 , FN_55%10 = 5 , FN_57%10 = 2 , FN_59%10 = 1 , FN_61%10 = 1 , FN_63%10 = 2
New D:
FN_3%10 = 2 , FN_7%10 = 3 , FN_11%10 = 9 , FN_15%10 = 0 , FN_19%10 = 1 , FN_23%10 = 7 , FN_27%10 = 8 , FN_31%10 = 9 , FN_35%10 = 5 , FN_39%10 = 6 , FN_43%10 = 7 , FN_47%10 = 3 , FN_51%10 = 4 , FN_55%10 = 5 , FN_59%10 = 1 , FN_63%10 = 2
New D:
FN_7%10 = 3 , FN_15%10 = 0 , FN_23%10 = 7 , FN_31%10 = 9 , FN_39%10 = 6 , FN_47%10 = 3 , FN_55%10 = 5 , FN_63%10 = 2
New D:
FN_15%10 = 0 , FN_31%10 = 9 , FN_47%10 = 3 , FN_63%10 = 2
New D:
FN_31%10 = 9 , FN_63%10 = 2
New D:
FN_63%10 = 2
solutionBruteForce: 2
what FN means ?
Sorry, thatās a typo - should just be F
.
sirā¦
we have Fibonacci no as
0 1 1 2 3 5 8 13 21 34 55 89ā¦
if in question letās say we are given n=64
then we know that at 64th position the number is 10610209857723
by eliminating odd position each time we will have n=64 at last.
and 10610209857723%10 will be 3 then why the answer will be 2
sir please help
we have Fibonacci no as
0 1 1 2 3 5 8 13 21 34 55 89ā¦
if in question letās say we are given n=64
then we know that at 64th position the number is 10610209857723
by eliminating odd position each time we will have n=64 at last.
and 10610209857723%10 will be 3 then why the answer will be 2