Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner tamere = new Scanner(System.in);
- int rigoloNombre = tamere.nextInt();
- int resultons = recurenceDuGhetto.testonsCa(rigoloNombre);
- System.out.println(resultons);
- }
- }
- public class recurenceDuGhetto {
- public recurenceDuGhetto() {
- }
- public static int testonsCa(int n) {
- if (n == 0 || n == 1) {
- return 1;
- }
- if (n == 2)
- return 2;
- if (n == 3)
- return 5;
- else{
- int resultat = 1;
- for (int i = 1; i < n; i++){
- int extra = (n - i) * testonsCa(i);
- resultat = resultat + extra;
- //System.out.println(i + " i bah il vaut et extra il vaut " + extra + " et enfin result " + resultat);
- }
- return resultat;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement