#include <iostream> #include <cstdio> using namespace std; int n, a; int tab[305]; int main () { scanf("%d", &n); for (int i = 1; i <= n; ++i) scanf("%d", &tab[i]); for (int i = 1; i < n; ++i) for (int j = i + 1; j <= n; ++j) if (tab[j] - tab[i] > tab[j - i]) { printf("NIE\n"); return 0; } printf("TAK\n%d\n", n); for (int i = 1; i <= n; ++i) { a = tab[i] - tab[i - 1]; printf("%d ", a); } printf("\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 | #include <iostream> #include <cstdio> using namespace std; int n, a; int tab[305]; int main () { scanf("%d", &n); for (int i = 1; i <= n; ++i) scanf("%d", &tab[i]); for (int i = 1; i < n; ++i) for (int j = i + 1; j <= n; ++j) if (tab[j] - tab[i] > tab[j - i]) { printf("NIE\n"); return 0; } printf("TAK\n%d\n", n); for (int i = 1; i <= n; ++i) { a = tab[i] - tab[i - 1]; printf("%d ", a); } printf("\n"); return 0; } |