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
33
34
35
36
37
38
39
#include <iostream>
using namespace std;
int num[301];
int delta[301];
int main() {
	short int n;
	bool nie = 0;
	long long int current=0;
	cin >> n;
	for (int a = 0; a < n; a++) {
		cin >> num[a];
	}
	delta[0] = num[0];
	for (int a = 1; a < n; a++) {
		delta[a] = num[a] - num[a - 1];
	}
	for (int a = 0; a < n; a++) {
		current = 0;
		for (int b = 0; b < a; b++) {
			current += delta[b];
		}
		for (int b = a; b < n - a; b++) {
			current -= delta[b - a];
			current += delta[b];
			if (current > delta[a]) {
				nie = 1;
				break;
			}
		}
		if (nie == 1) { break; }
	}
	if (nie == 1) { cout << "NIE"; }
	else {
		cout << "TAK" << '\n' << n << '\n';
		for (int a = 0; a < n; a++) {
			cout << delta[a]<<' ';
		}
	}
}