July 2022 1 6 Report
Определите, количество чисел K, для которых следующая программа выведет такой же результат, что и для K = 30:


#include
using namespace std;
int F(int x)
{
if (x < 3)
return 1;
else
return 2 * F(x - 1) + F(x - 2);
}
int main()
{
int i, k; i = 15;
cin >> k;
while (i > 0 && F(i) > k)
i = i - 1;
cout << i;
}
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.