#include <iostream> int a[307], n, result = 1, i, j; int main() { std::ios_base::sync_with_stdio(0); for(std::cin >> n, i = 1; i <= n; i++) for(j = 0, std::cin >> a[i]; j < i; j++) if(a[j] + a[i - j] < a[i]) result = 0; if(result) { std::cout << "TAK\n" << n << '\n'; for(i = 1; i <= n; i++) std::cout << a[i] - a[i - 1] << ' '; std::cout << '\n'; } else std::cout << "NIE\n"; return 0; } /* 10 3 1 4 1 5 9 2 6 5 3 */
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <iostream> int a[307], n, result = 1, i, j; int main() { std::ios_base::sync_with_stdio(0); for(std::cin >> n, i = 1; i <= n; i++) for(j = 0, std::cin >> a[i]; j < i; j++) if(a[j] + a[i - j] < a[i]) result = 0; if(result) { std::cout << "TAK\n" << n << '\n'; for(i = 1; i <= n; i++) std::cout << a[i] - a[i - 1] << ' '; std::cout << '\n'; } else std::cout << "NIE\n"; return 0; } /* 10 3 1 4 1 5 9 2 6 5 3 */ |