#include <stdio.h> #include <stdlib.h> int main() { int n; scanf("%d", &n); int *a = (int*)calloc(n, sizeof(*a)); for (int i = 0; i < n; i++) scanf("%d", &a[i]); for (int i = 1; i < n; i++) { if (a[i] - a[i-1] > a[0]) { printf("NIE\n"); return 0; } } printf("TAK\n%d\n%d ", n, a[0]); for (int i = 1; i < n; i++) { printf("%d ", a[i] - a[i-1]); } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <stdio.h> #include <stdlib.h> int main() { int n; scanf("%d", &n); int *a = (int*)calloc(n, sizeof(*a)); for (int i = 0; i < n; i++) scanf("%d", &a[i]); for (int i = 1; i < n; i++) { if (a[i] - a[i-1] > a[0]) { printf("NIE\n"); return 0; } } printf("TAK\n%d\n%d ", n, a[0]); for (int i = 1; i < n; i++) { printf("%d ", a[i] - a[i-1]); } return 0; } |