fork download
  1. class Main{
  2. public static void main (String[] args) throws java.lang.Exception {
  3. java.util.Scanner i = new java.util.Scanner(System.in);
  4. int n = i.nextInt();
  5. long array[] = new long[61];
  6. array[0] = 1;
  7. array[1] = 1;
  8. array[2] = 2;
  9. for(int k = 3; k <= n; k++) {
  10. array[k] = array[k-1] + array[k-2] + array[k-3];
  11. }
  12. System.out.print(array[n]);
  13. }
  14. }
Success #stdin #stdout 0.12s 35196KB
stdin
60
stdout
4680045560037375