Skip to content

Instantly share code, notes, and snippets.

@JosiasAurel
Created December 18, 2019 15:50
Show Gist options
  • Save JosiasAurel/68b5a066990c2e64c8a5ac2a76f748c5 to your computer and use it in GitHub Desktop.
Save JosiasAurel/68b5a066990c2e64c8a5ac2a76f748c5 to your computer and use it in GitHub Desktop.
Fibonacci.java
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