3-Mavzu: Binar qidiruv. Qidiruv



Yüklə 204,01 Kb.
səhifə5/5
tarix20.10.2023
ölçüsü204,01 Kb.
#157840
1   2   3   4   5
3-Amaliyot. (Qidirish)

Kiruvchi ma’lumotlar

Chiquvchi ma’lumotlar

1

4
5 2 5 3
3
5 1 8
10

3

2

1
5
1
4
10

0


4-Topshiriq

Fibonacci sequence - it's a sequence in which each element is equal to the sum of the two previous ones, except for the first two elements of F1 = 1F2 = 1Fn = Fn-2 + Fn-1.


1 1 2 3 5 8 13 21 …
Given an array of integers, of which perhaps is the Fibonacci numbers. Count the Fibonacci numbers in a given set of numbers.
Input__The_first_line_contains_the_number_k'>Input
The first line contains the number k - the number of numbers in the next line contains k integers a1,a2, …, ak (0 < ≤ 1051 ≤ ai < 263).
Output
 Print a single number - the count of Fibonacci numbers.
Samples



Input

Output

1

5
1 3 5 6 13

4


5-Topshiriq
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.
You are given an array of n positive integers. Determine the numbers of T-primes among them.
Input
The first line contains a single positive integern (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012).
Output
Print one number: the numbers of T-Primes.
Sample



Input

Output

1

3

4 5 6


1

Note:
4 has exactly three divisors — 1, 2 and 4. It is T-Prime.
5 has two divisors (1 and 5). It is not T-Prime.
6 has four divisors (1, 2, 3, 6). It is not T-Prime.

475. Aylanalar




6-Topshiriq
Sizga bir o’lchamli a va b massivlar berilgan. Ikkinchi massivning har bir bj elementi uchun a massivda undan kichik yoki teng elementlarning sonini toping.
Kiruvchi ma’lumotlar
Birinchi qatorda n va m butun sonlari – massivlar o’lchamlari berilgan(1≤n,m≤105). Ikkinchi qatorda n ta butun son – a massiv elementlari probel bilan ajratilgan holda beriladi(-109ai≤109). Uchinchi qatorda m ta butun sonlar – b massiv elementlari beriladi(-109bj≤109).
Chiquvchi ma’lumotlar
Bitta butun sonni - har bir so’rovga javoblar yi’gindisini chiqaring.
Misollar



Kiruvchi ma’lumotlar

Chiquvchi ma’lumotlar

1

5 4
1 3 5 7 9
6 4 2 8

10

2

5 5
1 2 1 2 5
3 1 4 1 5

17

Yüklə 204,01 Kb.

Dostları ilə paylaş:
1   2   3   4   5




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin