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
#include <iostream>

using namespace std;

const int N=305;
long long int sum[N],wyn[N],lim[N];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie();
    int n,k;
    cin>>n>>wyn[1]; lim[1]=sum[1]=wyn[1];
    for(int i=2;i<=n;i++)
    {
        cin>>lim[i];
        wyn[i]=lim[i]-sum[i-1]; sum[i]=sum[i-1]+wyn[i];
        for(int j=i-1;j>0;j--)
        {
            sum[j]=sum[j]-wyn[i-j]+wyn[i];
            if(sum[j]>lim[j])
                { cout<<"NIE\n"; return 0;}
        }
    }
    cout<<"TAK\n"<<n<<"\n";
    for(int i=1;i<=n;i++)
        cout<<wyn[i]<<" ";
    return 0;
}