#include <stdio.h>
#include <vector>
using namespace std;
int main() {
int n;
scanf("%d", &n);
vector<long long> ans(n);
long long sum = 0;
bool ok = true;
for (int i = 0; i < n; i++) {
scanf("%lld", &ans[i]);
ans[i] = ans[i] - sum;
if (ans[i] > ans[0]) ok = false;
sum += ans[i];
}
if (ok) printf("TAK\n%d\n", n);
else printf("NIE\n");
for (int i = 0; i < n && ok; i++) {
printf("%lld ", ans[i]);
}
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 | #include <stdio.h> #include <vector> using namespace std; int main() { int n; scanf("%d", &n); vector<long long> ans(n); long long sum = 0; bool ok = true; for (int i = 0; i < n; i++) { scanf("%lld", &ans[i]); ans[i] = ans[i] - sum; if (ans[i] > ans[0]) ok = false; sum += ans[i]; } if (ok) printf("TAK\n%d\n", n); else printf("NIE\n"); for (int i = 0; i < n && ok; i++) { printf("%lld ", ans[i]); } return 0; } |
English