杭电acm 1033题
After several such folding steps have been performed we may unfold the sheet again and take a look at its longer edge holding the sheet so that it appears as a one-dimensional curve, actually a concatenation of line segments. If we move along this curve in a fixed direction we can classify every place where the sheet was folded as either type A meaning a clockwise turn or type V meaning a counter-clockwise turn. Given such a sequence of classifications, produce a drawing of the longer edge of the sheet assuming 90 degree turns at equidistant places.
You may display such drawings with the gv PostScript interpreter, optionally after a conversion using the ps2ps utility.
AVV
310 420 lineto
310 430 lineto
stroke
showpage
300 420 moveto
310 420 lineto
310 410 lineto
320 410 lineto
320 420 lineto
stroke
showpage
/**********************************************
杭电acm 1033题 已AC
***********************************************/
#include <iostream>
using namespace std;
int main(void)
{
char test[];
int len;
int flag;//1,2,3,4分别代表上下左右
int edge[]={,};
while(scanf("%s",test)!=EOF)
{
len=strlen(test);
for(int i=;i<len;i++)
{
if(i==&&test[i]=='V')
{
cout<<edge[]<<" "<<edge[]<<" "<<"moveto"<<endl;
edge[]+=;
cout<<edge[]<<" "<<edge[]<<" "<<"lineto"<<endl;
edge[]+=;
cout<<edge[]<<" "<<edge[]<<" "<<"lineto"<<endl;
flag=;
}
if(i==&&test[i]=='A')
{
cout<<edge[]<<" "<<edge[]<<" "<<"moveto"<<endl;
edge[]+=;
cout<<edge[]<<" "<<edge[]<<" "<<"lineto"<<endl;
edge[]-=;
cout<<edge[]<<" "<<edge[]<<" "<<"lineto"<<endl;
flag=;
}
if(i>&&flag==&&test[i]=='V')//以下考虑八种情况即可,每次情况只执行一次,否则输出会有问题
{
edge[]-=;
cout<<edge[]<<" "<<edge[]<<" "<<"lineto"<<endl;
flag=;
continue;
}
if(i>&&flag==&&test[i]=='V')
{
edge[]+=;
cout<<edge[]<<" "<<edge[]<<" "<<"lineto"<<endl;
flag=;
continue;
}
if(i>&&flag==&&test[i]=='V')
{
edge[]-=;
cout<<edge[]<<" "<<edge[]<<" "<<"lineto"<<endl;
flag=;
continue;
}
if(i>&&flag==&&test[i]=='V')
{
edge[]+=;
cout<<edge[]<<" "<<edge[]<<" "<<"lineto"<<endl;
flag=;
continue;
} if(i>&&flag==&&test[i]=='A')
{
edge[]+=;
cout<<edge[]<<" "<<edge[]<<" "<<"lineto"<<endl;
flag=;
continue;
}
if(i>&&flag==&&test[i]=='A')
{
edge[]-=;
cout<<edge[]<<" "<<edge[]<<" "<<"lineto"<<endl;
flag=;
continue;
}
if(i>&&flag==&&test[i]=='A')
{
edge[]+=;
cout<<edge[]<<" "<<edge[]<<" "<<"lineto"<<endl;
flag=;
continue;
}
if(i>&&flag==&&test[i]=='A')
{
edge[]-=;
cout<<edge[]<<" "<<edge[]<<" "<<"lineto"<<endl;
flag=;
continue;
}
}
cout<<"stroke"<<endl<<"showpage"<<endl;
edge[]=;
edge[]=; }
return ;
}
程序考虑八种情况即可....
杭电acm 1033题的更多相关文章
- 杭电acm 1076题
水题,一个求闰年的题目,复习一下闰年的求法.... 1,如果能被4整除但不能被100整除的是闰年 2,能被400整除的是闰年 题目大意是:给定一个开始年份T以及一个正数N,要求求出从T开始,到了哪一年 ...
- 杭电acm 1037题
本题应该是迄今为止最为简单的一道题,只有一组输入,输出也简单.... /****************************************** 杭电acm 1037题 已AC ***** ...
- 杭电acm 1038题
本题比较简单,但是需要掌握几个小技巧,先上代码 /************************************* 杭电ACM 1038题,已AC ********************* ...
- 杭电acm 1049题
一道水题..... 大意是一条1inch的虫子在一个n inch的盒子的底部,有足够的能够每一分钟往上爬u inch,但是需要休息一分钟,这期间会往下掉d inch,虫子爬到盒子口即认为结束.要求计算 ...
- 杭电ACM刷题(1):1002,A + B Problem II 标签: acmc语言 2017-05-07 15:35 139人阅读 评
最近忙于考试复习,没有多少可供自己安排的时间,所以我利用复习之余的空闲时间去刷刷杭电acm的题目,也当对自己编程能力的锻炼吧. Problem Description I have a very si ...
- 杭电acm刷题顺序
最近兴趣来了,闲暇之余,回顾大学期间刷过的杭电acm那些入门级别的题,以此巩固基础知识! 以下参考刷题顺序,避免入坑 原文传送门:https://blog.csdn.net/liuqiyao_01/a ...
- 杭电acm 1015题
马上要找工作了,锻炼下自己的写程序能力,不多说,上代码 /********************杭电acm 1015 已AC 在这个程序里,使用穷举法来实现,但是输出顺序需要安装字典的最大 来输出 ...
- 杭电acm 1040题
本题是一个非常简单的升序排序题目,但那时在做的时候把题目看错了,导致花费了大量的时间来检查为什么WA,最后发现题目看错了..... /********************************* ...
- 杭电acm 1098题
Problem Description Ignatius is poor at math,he falls across a puzzle problem,so he has no choice bu ...
随机推荐
- Yii2学习笔记---内附GridView配置总结
1./vendor/yiisoft/yii2/web/UrlManager.php 方法createUrl 修改url参数转码2.config/web.php 配置文件Yii::$app(应用主体)的 ...
- Spring Cloud之Zuul负载均衡
Zuul网关默认是实现负载均衡的,不需要任何配置.默认开启ribbon效果的 可以启启动两个服务端口,访问下.
- jQuery横向手风琴图片滑块
jQuery横向手风琴图片滑块是一款非常不错的jQuery特效横向手风琴图片滑块插件,可以自动播放,也可以鼠标滑过时切换.+ 欢迎喜欢的朋友下载研究 源码下载页:http://www.huiyi8.c ...
- L103
Give everyday the chance to become the most beautiful day of your life.把每天都过成你生命中最美好的一天.competence 能 ...
- codeforces 710B B. Optimal Point on a Line(数学)
题目链接: B. Optimal Point on a Line 题意: 给出n个点,问找出一个点使得这个点到所有的点的距离和最小; 思路: 所有点排序后的中位数;这是一个结论; AC代码: #inc ...
- 七牛 python
Python SDK使用指南 上传策略 变量 对象存储 API 参考手册 多媒体数据处理 API 参考手册
- 关于avpicture_fill 和 sws_scale的关系
avpicture_fill((AVPicture *) pFrameRGB, buffer, PIX_FMT_RGB565, pCodecCtx->width, pCodecCtx->h ...
- loj515贪心只能过样例
bitset练习题... 位运算真的是玄学... 一开始真的“只能过样例” 后来发现把左移写成了小于号 鬼知道我在想什么/手动微笑 loj第一题 #include<iostream> #i ...
- CodeForces - 1017F. The Neutral Zone (数学+Bitset存素数+素数筛优化)
Notice: unusual memory limit! After the war, destroyed cities in the neutral zone were restored. And ...
- BZOJ4545: DQS的trie
BZOJ4545: DQS的trie https://lydsy.com/JudgeOnline/problem.php?id=4545 分析: 对trie用dfs建sam复杂度是\(O(n^2)\) ...