#include<iostream> using namespace std; int arr[1100] = { 0, }; int main(){ arr[0] = 1; arr[1] = 1; int n, ans; cin>> n; for(int i = 2; i<=n; i++){ arr[i] = (arr[i-1] + arr[i-2] * 2) % 10007; } cout<<arr[n]<<endl; }
#include<iostream> using namespace std; int arr[1100] = { 0, }; int main(){ arr[0] = 1; arr[1] = 1; int n, ans; cin>> n; for(int i = 2; i<=n; i++){ arr[i] = (arr[i-1] + arr[i-2]) % 10007; } cout<<arr[n]<<endl; }
#include <iostream> int a[1001]; int main() { int n; std::cin >> n; a[1] = 1; a[2] = 3; for (int i = 3; i <= n; i++) { a[i] = (a[i - 1] + a[i - 2] * 2) % 10007; } std::cout << a[n]; return 0; }
#include <iostream> int a[1001]; int main() { int n; std::cin >> n; a[1] = 1; a[2] = 2; for (int i = 3; i <= n; i++) { a[i] = (a[i - 1] + a[i - 2]) % 10007; } std::cout << a[n]; return 0; }