Run ID:147965

提交时间:2026-02-09 09:35:18

#include <iostream> using namespace std; int Fib(int n) { if (n == 1) return 1; if (n == 2) return 2; int a = 1; int b = 2; int c; for (int i = 3; i <= n; i++) { c = a + b; a = b; b = c; } return c; } int main() { int T, N; cin >> T; while (T--) { cin >> N; cout << Fib(N) << endl; } return 0; }