import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer sb = new StringBuffer("");
long fib[] = new long[52];
fib[0] = 1;
fib[1] = 2;
for (int i = 2; i < 52; i++) {
fib[i] = fib[i - 2] + fib[i - 1];
}
int cases = Integer.parseInt(br.readLine());
for (int i = 0; i < cases; i++) {
int m = Integer.parseInt(br.readLine());
sb.append("Scenario #").append((i+1)).append(":\n").append(fib[m]).append("\n\n");
}
System.out.print(sb);
}
}
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer sb = new StringBuffer("");
long fib[] = new long[52];
fib[0] = 1;
fib[1] = 2;
for (int i = 2; i < 52; i++) {
fib[i] = fib[i - 2] + fib[i - 1];
}
int cases = Integer.parseInt(br.readLine());
for (int i = 0; i < cases; i++) {
int m = Integer.parseInt(br.readLine());
sb.append("Scenario #").append((i+1)).append(":\n").append(fib[m]).append("\n\n");
}
System.out.print(sb);
}
}
No comments:
Post a Comment