Add FZOI Codes

This commit is contained in:
2024-06-26 22:14:00 +08:00
parent 8f564ca60e
commit b80791cfad
49 changed files with 1653 additions and 0 deletions

29
FZOI/神犇 炸弹.cpp Normal file
View File

@ -0,0 +1,29 @@
#include <iostream>
#define int long long
using namespace std;
int m;
int arr[1000005];
int f(int x)
{
if(arr[x] == 1) return 0;
if(x == 1) return 1;
if(x == 2) return 2;
if(x == 3) return 4;
return f(x - 1) + f(x - 2) + f(x - 3);
}
signed main()
{
int n;
cin >> n >> m ;
for(int i = 1; i <= m; ++ i)
{
int a;
cin >> a ;
arr[a] = 1;
}
cout << f(n) ;
return 0;
}