#include <iostream> int main() { int LLC = 30; int TablicaLC[LLC]; for (int i = 0; i < LLC; i++) { if (i == 0 || i == 1) { TablicaLC[i] = i; } else { TablicaLC[i] = (TablicaLC[i-1] + TablicaLC[i-2]); } } int Prob; bool Prawda = false; bool *WB; WB = &Prawda; std::cin >> Prob; int TablicaP[Prob]; for (int i = 0; i<Prob; i++) { std::cin >> TablicaP[i]; } for (int x = 0; x<Prob; x++) { *WB = false; for (int y = 0; y<LLC; y++) { for (int z = 0; z<LLC; z++) { if (TablicaP[x] == (TablicaLC[y] * TablicaLC[z])) { *WB = true; } } } if (*WB == true) std::cout << "\n" << TablicaP[x] << "\tTAK"; else std::cout << "\n" << TablicaP[x] << "\tNIE"; } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #include <iostream> int main() { int LLC = 30; int TablicaLC[LLC]; for (int i = 0; i < LLC; i++) { if (i == 0 || i == 1) { TablicaLC[i] = i; } else { TablicaLC[i] = (TablicaLC[i-1] + TablicaLC[i-2]); } } int Prob; bool Prawda = false; bool *WB; WB = &Prawda; std::cin >> Prob; int TablicaP[Prob]; for (int i = 0; i<Prob; i++) { std::cin >> TablicaP[i]; } for (int x = 0; x<Prob; x++) { *WB = false; for (int y = 0; y<LLC; y++) { for (int z = 0; z<LLC; z++) { if (TablicaP[x] == (TablicaLC[y] * TablicaLC[z])) { *WB = true; } } } if (*WB == true) std::cout << "\n" << TablicaP[x] << "\tTAK"; else std::cout << "\n" << TablicaP[x] << "\tNIE"; } return 0; } |