#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main()
{
ios_base::sync_with_stdio();
int n, t;
string a;
cin >> n >> t;
getchar();
getline(cin, a);
if (t%2==0)
cout << a;
else
for (int i=a.size()-1; i>=0; i--)
putchar(a[i]);
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> #include <cstdio> #include <string> using namespace std; int main() { ios_base::sync_with_stdio(); int n, t; string a; cin >> n >> t; getchar(); getline(cin, a); if (t%2==0) cout << a; else for (int i=a.size()-1; i>=0; i--) putchar(a[i]); return 0; } |
English