#include <cstdio> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define INT(x) int x; scanf("%d", &x) int a[300]; int main() { INT(n); REP(i,n) scanf("%d", &a[i]); REP(i,n) REP(j,i) if (a[i] > a[j] + a[i - j - 1]) { printf("NIE\n"); return 0; } printf("TAK\n%d\n", n); int x = 0; REP(i,n) { if (i) printf(" "); printf("%d", a[i] - x); x = a[i]; } printf("\n"); }
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 | #include <cstdio> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define INT(x) int x; scanf("%d", &x) int a[300]; int main() { INT(n); REP(i,n) scanf("%d", &a[i]); REP(i,n) REP(j,i) if (a[i] > a[j] + a[i - j - 1]) { printf("NIE\n"); return 0; } printf("TAK\n%d\n", n); int x = 0; REP(i,n) { if (i) printf(" "); printf("%d", a[i] - x); x = a[i]; } printf("\n"); } |