#include <cstdio> int t[305]; int main(){ int n; scanf("%d", &n); for (int i = 1; i <= n; i++){ scanf("%d", &t[i]); } for (int i = 1; i <= n; i++){ for (int j = 0; j < i; j++){ if (t[i] - t[j] > t[i - j]){ printf("NIE\n"); return 0; } } } printf("TAK\n"); printf("%d\n", n); for (int i = 1; i <= n; i++){ printf("%d ", t[i] - t[i - 1]); } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <cstdio> int t[305]; int main(){ int n; scanf("%d", &n); for (int i = 1; i <= n; i++){ scanf("%d", &t[i]); } for (int i = 1; i <= n; i++){ for (int j = 0; j < i; j++){ if (t[i] - t[j] > t[i - j]){ printf("NIE\n"); return 0; } } } printf("TAK\n"); printf("%d\n", n); for (int i = 1; i <= n; i++){ printf("%d ", t[i] - t[i - 1]); } } |