题意:没看懂题意,直接猜的。(英语渣的日常)。输入中有A和V两种,V是逆时针,A是顺时针。脑补的题意:在当前情况下加一条长度为10的线,加的这条线的方向是上一条加的线的方向旋转
90。
,这个旋转是顺时针旋转还是逆时针旋转看的就是A和V。开始是从
(300,420)
到
(310,420)
。
思路:只要能读懂或猜懂题目,基本可以AC,直接模拟即可。
http://acm.hdu.edu.cn/showproblem.php?pid=1033
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define rep(i,a,b) for(int i = a ; i <= b ; i ++)
#define rrep(i,a,b) for(int i = b ; i >= a ; i --)
#define repE(p,u) for(Edge * p = G[u].first ; p ; p = p -> next)
#define cls(a,x) memset(a,x,sizeof(a))
#define eps 1e-8
using namespace std;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e5+5;
const int MAXE = 2e5+5;
typedef long long LL;
typedef unsigned long long ULL;
int T,n,m,k;
char s[205];
int fx[] = {0,10,-10,0,0};
int fy[] = {0,0,0,10,-10};
void input() {
}
void solve() {
int lens = strlen(s);
puts("300 420 moveto\n310 420 lineto");
int op = 1;
int x = 310 , y = 420 ;
rep(i,0,lens-1) {
switch(op) {
case 1 : if(s[i] == 'V') op = 3 ; else op = 4 ; break;
case 2 : if(s[i] == 'V') op = 4 ; else op = 3 ; break;
case 3 : if(s[i] == 'V') op = 2 ; else op = 1 ; break;
case 4 : if(s[i] == 'V') op = 1 ; else op = 2 ; break;
}
x += fx[op]; y += fy[op];
printf("%d %d lineto\n",x,y);
}
puts("stroke\nshowpage");
}
int main(void) {
while(~scanf("%s",s)) {
input();
solve();
}
return 0;
}