Codeforces Coder-Strike 2014 - Round 1 Problem A - Poster:
http://codeforces.com/contest/412/problem/A
Codeforces Coder-Strike 2014 - Round 1 Problem A - Poster solution:
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
int n, k, t;
char s[105];
scanf("%d%d", &n, &k);
scanf("%s", s);
//printf("%s", s);
if(k>n/2) {
t=n-k;
while(t--) printf("RIGHT\n");
t=n;
while(t--) {
printf("PRINT %c\n", s[t]);
if(t) printf("LEFT\n");
}
}
else {
t=k-1;
while(t--) printf("LEFT\n");
for(int i=0; i<n; i++) {
printf("PRINT %c\n", s[i]);
if(i<n-1) printf("RIGHT\n");
}
}
return 0;
}
No comments:
Post a Comment