模拟 Coder-Strike 2014 - Round 1 A. Poster

时间:2022-04-18 15:20:37

题目地址:http://codeforces.com/problemset/problem/412/A

 /*
模拟:题目没看懂,但操作很简单,从最近的一头(如果不在一端要先移动到一端)往另一头移动,顺便打印内容
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
using namespace std; const int MAXN = + ;
const int INF = 0x3f3f3f3f;
char s[MAXN]; int main(void) //Coder-Strike 2014 - Round 1 A. Poster
{
//freopen ("E.in", "r", stdin); int n, k;
while (~scanf ("%d%d", &n, &k))
{
scanf ("%s", &s);
int pos; int flag; if (k <= (n) / )
{
pos = k - ; flag = ;
}
else
{
pos = n - k; flag = ;
} while (pos--) (flag) ? puts ("RIGHT") : puts ("LEFT"); if (flag == )
{
for (int i=n-; i>=; --i)
{
printf ("PRINT ");
printf ("%c\n", s[i]);
if (i > ) puts ("LEFT");
}
}
else
{
for (int i=; i<n; ++i)
{
printf ("PRINT ");
printf ("%c\n", s[i]);
if (i < n - ) puts ("RIGHT");
}
}
} return ;
}