#include <stdio.h> int main() { int tab[50]; tab[0] = 1; tab[1] = 2; int lastIndex = 1; while (tab[lastIndex] <= 1000000000) { lastIndex++; tab[lastIndex] = tab[lastIndex - 1] + tab[lastIndex - 2]; } int rows = 0; scanf("%i", &rows); int dataSet = 0; int i = 0; int j = 0; for (dataSet = 0; dataSet < rows; dataSet++) { int current = 0; scanf("%i", ¤t); char runFlag = 1; for (i = 0; (i <= lastIndex && runFlag); i++) { for (j = i; j <= lastIndex; j++) { if (tab[i] * tab[j] == current) { printf("TAK\n"); runFlag = 0; break; } } } if (runFlag == 1) { printf("NIE\n"); } } 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 | #include <stdio.h> int main() { int tab[50]; tab[0] = 1; tab[1] = 2; int lastIndex = 1; while (tab[lastIndex] <= 1000000000) { lastIndex++; tab[lastIndex] = tab[lastIndex - 1] + tab[lastIndex - 2]; } int rows = 0; scanf("%i", &rows); int dataSet = 0; int i = 0; int j = 0; for (dataSet = 0; dataSet < rows; dataSet++) { int current = 0; scanf("%i", ¤t); char runFlag = 1; for (i = 0; (i <= lastIndex && runFlag); i++) { for (j = i; j <= lastIndex; j++) { if (tab[i] * tab[j] == current) { printf("TAK\n"); runFlag = 0; break; } } } if (runFlag == 1) { printf("NIE\n"); } } return 0; } |