#include <cstdio> #include <cstdlib> int nums[512]; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d", &nums[i]); } for (int i = 1; i <= n; i++) { for (int j = 1; 2 * j <= i; j++) { if (nums[j] + nums[i - j] < nums[i]) { puts("NIE"); return 0; } } } puts("TAK"); printf("%d\n", n); int sum = 0; for (int i = 1; i <= n; i++) { printf((i == 1) ? "%d" : " %d", nums[i] - nums[i - 1]); } puts(""); 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 <cstdio> #include <cstdlib> int nums[512]; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d", &nums[i]); } for (int i = 1; i <= n; i++) { for (int j = 1; 2 * j <= i; j++) { if (nums[j] + nums[i - j] < nums[i]) { puts("NIE"); return 0; } } } puts("TAK"); printf("%d\n", n); int sum = 0; for (int i = 1; i <= n; i++) { printf((i == 1) ? "%d" : " %d", nums[i] - nums[i - 1]); } puts(""); return 0; } |