규칙을 찾기 위해 손으로 하나하나 적어봤다 N=1 - 1 N=2 - 00,11 N=3 - 001, 100, 111 N=4 - 0000, 0011, 1100, 1001, 1111 N=5 - 00001, 10000, 00111, 11100, 10011, 11001, 11111 · · · 쭉쭉 하다보면 f(n) = f(n-1) + f(n-2)의 점화식을 세울 수 있다 (n>2) 123456789101112131415161718192021#include using namespace std; int n;unsigned long long arr[1000001] = { 0,1,2 }; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; if (n