#include <stdio.h> int main() { int n; int a[301]; int b[301]; scanf("%d", &n); a[0] = 0; for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i <= n; i++) for (int j = 1; i + j <= n; j++) if (a[i] + a[j] < a[i + j]) { printf("NIE\n"); return 0; } printf("TAK\n"); printf("%d\n", n); for (int i = 1; i <= n; i++) { printf("%d ", a[i] - a[i-1]); } 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 28 29 30 31 32 | #include <stdio.h> int main() { int n; int a[301]; int b[301]; scanf("%d", &n); a[0] = 0; for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i <= n; i++) for (int j = 1; i + j <= n; j++) if (a[i] + a[j] < a[i + j]) { printf("NIE\n"); return 0; } printf("TAK\n"); printf("%d\n", n); for (int i = 1; i <= n; i++) { printf("%d ", a[i] - a[i-1]); } printf("\n"); return 0; } |