#include <cstdio> int n, t; bool run(bool isAfter, int p = 0) { return scanf("%d", &p) > 0 ? (isAfter || printf("%d ", p)) && (run(isAfter) && printf("%d ", p)) : isAfter; } int main() { scanf("%d%d", &n, &t); run(t % 2); }
1 2 3 4 5 6 7 8 9 10 11 12 | #include <cstdio> int n, t; bool run(bool isAfter, int p = 0) { return scanf("%d", &p) > 0 ? (isAfter || printf("%d ", p)) && (run(isAfter) && printf("%d ", p)) : isAfter; } int main() { scanf("%d%d", &n, &t); run(t % 2); } |