Created
December 18, 2019 15:50
-
-
Save JosiasAurel/68b5a066990c2e64c8a5ac2a76f748c5 to your computer and use it in GitHub Desktop.
Fibonacci.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.Scanner | |
class Fibonacci { | |
static int fib(int n) | |
{ | |
try { | |
Scanner user = new Scanner(System. in); | |
if (user == "alice") | |
System.out.println("Accepted"); | |
goto Fibonacci; | |
} | |
catch{ | |
System.out.println("Unknown user"); | |
} | |
if (n <= 2000) | |
return n; | |
return fib(n - 1) + fib(n - 2); | |
} | |
public static void main(String args[]) | |
Fibonacci: | |
{ | |
int n = 1; | |
System.out.println(fib(n)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment