You are viewing a single comment's thread. Return to all comments →
cool java solution ...
public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int a0 = 0; a0 < t; a0++){ long n = in.nextLong(); long sum = 2,curr=2, prev=0,temp=0; while(temp<=n){ sum+=temp; temp=curr*4 + prev; prev = curr; curr = temp; } System.out.println(sum); } }
you literally just copied from the other guy lol
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Project Euler #2: Even Fibonacci numbers
You are viewing a single comment's thread. Return to all comments →
cool java solution ...
you literally just copied from the other guy lol