Skip to content

Instantly share code, notes, and snippets.

@yeopgi
Created August 28, 2021 05:18
Show Gist options
  • Save yeopgi/ed26adc880cdda9284f7590e169ac526 to your computer and use it in GitHub Desktop.
Save yeopgi/ed26adc880cdda9284f7590e169ac526 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int test;
cin >> test;
while (test--) {
long long d[101] = {0};
d[0] = 1, d[1] = 1, d[2] = 1, d[3] = 1;
int input;
cin >> input;
for (int i = 4; i <= input; i++) {
d[i] = d[i - 2] + d[i - 3];
}
cout << d[input] << '\n';
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment