Added my works from 2022

This commit is contained in:
2024-11-21 09:11:52 +03:00
parent facd000301
commit 02068890a5
7 changed files with 161 additions and 0 deletions

15
alg_4_5.cpp Normal file
View File

@@ -0,0 +1,15 @@
#include <iostream>
using namespace std;
int f(int n)
{
if (n == 1) { return 1; }
if (n % 2 == 0) { return f(n / 2); }
return f((n - 1) / 2) + f((n - 1) / 2 + 1);
}
int main()
{
int n; cin >> n;
cout << f(n);
}