#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int tablica[301]; bool possible; int a; int main() { possible = true; cin>>a; for(int i=1; i<=a; i++){ cin>>tablica[i]; for(int x=1; x*2<=i; x++){ if(tablica[x]+tablica[i-x]<tablica[i]) possible = false; } } if(possible){ cout<<"TAK"<<endl<<a<<endl; cout<<tablica[1]<<" "; for(int i=2; i<=a; i++){ cout<<tablica[i]-tablica[i-1]<<" "; } } else cout<<"NIE"; 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 | #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int tablica[301]; bool possible; int a; int main() { possible = true; cin>>a; for(int i=1; i<=a; i++){ cin>>tablica[i]; for(int x=1; x*2<=i; x++){ if(tablica[x]+tablica[i-x]<tablica[i]) possible = false; } } if(possible){ cout<<"TAK"<<endl<<a<<endl; cout<<tablica[1]<<" "; for(int i=2; i<=a; i++){ cout<<tablica[i]-tablica[i-1]<<" "; } } else cout<<"NIE"; return 0; } |