shuldn't it be f(246+m)%10 last one
On Thu, Jun 16, 2011 at 9:04 AM, saurabh singh saurab...@gmail.com wrote:
t,m;f(n){return n=2?1:f(n-1)+f(n-2);}
main(){scanf(%d,t);while(t--)scanf(%d,m)printf(%d\n,f(m+11)-f(m+1)+f(6+m)%10));}
My best attempt with the c code..132 bytes still
Now
ACTUALLY FIBBONACCI SERIERS REAPEAT AFTER 60 TERM SO 246%60 WILLBE 6 SO WE
ONLY HAVE TO FIND M+6 TERM
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this
got it repetition in cycles of 60
On Thu, Jun 16, 2011 at 12:35 PM, vaibhav agarwal
vibhu.bitspil...@gmail.com wrote:
shuldn't it be f(246+m)%10 last one
On Thu, Jun 16, 2011 at 9:04 AM, saurabh singh saurab...@gmail.comwrote:
t,m;f(n){return n=2?1:f(n-1)+f(n-2);}
without DP it will be TLE..
-
PRAMENDRA RATHI
NIT ALLAHABAD
On Thu, Jun 16, 2011 at 9:04 AM, saurabh singh saurab...@gmail.com wrote:
t,m;f(n){return n=2?1:f(n-1)+f(n-2);}
My AC solution is O(1).
On Thu, Jun 16, 2011 at 2:29 PM, PRAMENDRA RATHi rathi
prathi...@gmail.comwrote:
without DP it will be TLE..
-
PRAMENDRA RATHI
NIT ALLAHABAD
On Thu, Jun 16, 2011 at 9:04 AM, saurabh singh saurab...@gmail.comwrote:
Well dont know...My pure recursive solution in python got AC in 0.07s(93
bytes).No DP involved.And I don't think python is faster than c?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Very sorry i did used memoization..Ya not possible with o(2^n)
solution...Apologies once again
On Thu, Jun 16, 2011 at 3:21 PM, saurabh singh saurab...@gmail.com wrote:
Well dont know...My pure recursive solution in python got AC in 0.07s(93
bytes).No DP involved.And I don't think python
hint : think it as matrix raised to some power ( then u can compute that in
log(n) ) or other way around is to find cycle length . :-)
On Thu, Jun 16, 2011 at 3:56 PM, saurabh singh saurab...@gmail.com wrote:
Very sorry i did used memoization..Ya not possible with o(2^n)
@vipul what algo u have applied for o(1)??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
Binet's Formula.
( keep shortening :P )
On Thu, Jun 16, 2011 at 5:57 PM, kartik sachan kartik.sac...@gmail.comwrote:
@vipul what algo u have applied for o(1)??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
simple with AWK
-
PRAMENDRA RATHI
NIT ALLAHABAD
2011/6/16 • » νιρυℓ « • vipulmehta.1...@gmail.com
Binet's Formula.
( keep shortening :P )
On Thu, Jun 16, 2011 at 5:57 PM, kartik sachan kartik.sac...@gmail.comwrote:
@vipul what algo u have applied
most simple with bash..using formula 11*f(n+6)+11*f(n+6)%10
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
problem:::
https://www.spoj.pl/problems/FIBSUM/
can anyone suggest idea to reduce my code to 111 byte..its currebt size is
about 174
int a[50]={0},t,m;
f(int n) { return a[n]=a[n]?a[n]:n=2?1:f(n-1)+f(n-2); }
main() {
scanf(%d,t);
while(t--)
{ scanf(%d,m) ;
t,m;f(n){return n=2?1:f(n-1)+f(n-2);}
main(){scanf(%d,t);while(t--)scanf(%d,m)printf(%d\n,f(m+11)-f(m+1)+f(6+m)%10));}
My best attempt with the c code..132 bytes still
Now gonna try perlIt definitely requires exceptional skills to bring it
down to 111 bytes but have this gut feeling
You need to keep generating Fibonacci numbers until you meet the
condition.Check for even valued term by using TERM%2==0 and sum
up.Fibonacci series grows exponentially so n wont be very high.Take care
that it doesn't overflow integer range.
On Mon, Dec 20, 2010 at 8:36 PM, Shalini Sah
Each new term in the Fibonacci sequence is generated by adding the previous
two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
Find the sum of all the even-valued terms in the sequence which do not
exceed four million. I'm just a beginner..plz
16 matches
Mail list logo