在线编程在线课堂在线测评Anycodes在线编程

编程论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

How to use bs4??
本帖最后由 carry0987 于
Double Queue 问题描述 : The new founded Balkan Investment Group Bank (
John 问题描述 : Little John is playing very funny game
linux-command Linux命令大全搜索工具,内容包含Linux命令
Coati 是一款跨平台的代码查看工具,适用于 C/C++ 和 Java。商业软件。特性:1. 索引
系统可承载海量并发,消息收发确认机制 保障消息必达 系统采用动态智
全平台视频监控,支持安卓苹果以及pcweb,支持海康大华等主流dvr,全部源码以及文档 单聊、群聊、商
如何访问类的私有属性? 下面以 TPathData 为例,
问题:从 XE4 以来,Firemonkey 曲线绘图在移动平台不平滑的问题一直令人诟病,提交到官方的 QC 也是族繁不及备载,官方似乎有意的
操作数据库(RODBC)   odbcConnect(dsn, uid="", p
数据模式:mode函数显示任何对象的模式。常见的单个的
系统可承载海量并发,消息收发确认机制 保障消息必达 系统采用动态智
RabbitMQ与PHP(一) 项
Iease团队扩编预备中,盼望能有Ruby或者java工程师加盟。全职兼职都可以。有爱好的伴侣请与我接洽。 邮件:i
ruby 怎么设置装备摆设GTK2,求教指导下!
#include #include #include #include using namespace std; int main() {
标题如图所示: 有n盏灯,编号1~n。一开端灯都是关着的
成熟的消息收发确认机制,支持万人大群 支持开发自定义的消息sdk接口,扩展性超强 支持单/
成熟的消息收发确认机制,支持万人大群 支持开发自定义的消息sdk接口,扩展性超强 支持单/
1. 注意列表和集合的区别 set 列表表现形式: list_1
Ajax   Ajax即“Asynchronous Javascript And
大师好,我比来在做布谷鸟优
分辨提取A和B图像Harris角点,接下来须要对

[HDU杭电] HDU 1033 Edge-C++-[解题报告] C++

[复制链接]
发表于 2016-3-26 22:17:52 | 显示全部楼层 |阅读模式
Edge


问题描述 :
For products that are wrapped in small packings it is necessary that the sheet of paper containing the directions for use is folded until its size becomes small enough. We assume that a sheet of paper is rectangular and only folded along lines parallel to its initially shorter edge. The act of folding along such a line, however, can be performed in two directions: either the surface on the top of the sheet is brought together, or the surface on its bottom. In both cases the two parts of the rectangle that are separated by the folding line are laid together neatly and we ignore any differences in thickness of the resulting folded sheet.
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.
输入:
The input contains several test cases, each on a separate line. Each line contains a nonempty string of characters A and V describing the longer edge of the sheet. You may assume that the length of the string is less than 200. The input file terminates immediately after the last test case.
输出:
For each test case generate a PostScript drawing of the edge with commands placed on separate lines. Start every drawing at the coordinates (300, 420) with the command “300 420 moveto”. The first turn occurs at (310, 420) using the command “310 420 lineto”. Continue with clockwise or counter-clockwise turns according to the input string, using a sequence of “x y lineto” commands with the appropriate coordinates. The turning points are separated at a distance of 10 units. Do not forget the end point of the edge and finish each test case by the commands stroke and showpage.You may display such drawings with the gv PostScript interpreter, optionally after a conversion using the ps2ps utility.

HDU 1033 Edge-C++-[解题报告] C++

HDU 1033 Edge-C++-[解题报告] C++

样例输入:
  1. V
  2. AVV
复制代码
样例输出:
  1. 300 420 moveto
  2. 310 420 lineto
  3. 310 430 lineto
  4. stroke
  5. showpage
  6. 300 420 moveto
  7. 310 420 lineto
  8. 310 410 lineto
  9. 320 410 lineto
  10. 320 420 lineto
  11. stroke
  12. showpage
复制代码
转自:http://blog.csdn.net/a1dark分析:一道简单的模拟题、就是题目英文有点长、各种蛋疼、让你V和A分别逆时针旋转和顺时针旋转、然后输出转过之后的坐标就OK了、
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<stdio.h>
  4. #include<iostream>
  5. using namespace std;
  6. char st[205];
  7. int flag,x,y;
  8. void move(int &x,int &y,int &flag,char dict){
  9.     if(flag==0){
  10.         if(dict=='A'){
  11.             x=x+10;
  12.             y=y;
  13.             flag=1;
  14.         }
  15.         else{
  16.             x=x-10;
  17.             y=y;
  18.             flag=3;
  19.         }
  20.     }
  21.     else if(flag==1){
  22.         if(dict=='A'){
  23.             x=x;
  24.             y=y-10;
  25.             flag=2;
  26.         }
  27.         else{
  28.             x=x;
  29.             y=y+10;
  30.             flag=0;
  31.         }
  32.     }
  33.     else if(flag==2){
  34.         if(dict=='A'){
  35.             x=x-10;
  36.             y=y;
  37.             flag=3;
  38.         }
  39.         else{
  40.             x=x+10;
  41.             y=y;
  42.             flag=1;
  43.         }
  44.     }
  45.     else{
  46.         if(dict=='A'){
  47.             x=x;
  48.             y=y+10;
  49.             flag=0;
  50.         }
  51.         else{
  52.             x=x;
  53.             y=y-10;
  54.             flag=2;
  55.         }
  56.     }
  57. }
  58. int main(){
  59.     while(scanf("%s",&st)!=EOF){
  60.         printf("300 420 moveto\n310 420 lineto\n");
  61.         int len=strlen(st);
  62.         flag=1;
  63.         int i;
  64.         x=310;y=420;
  65.         for(i=0;i<len;i++){
  66.             move(x,y,flag,st[i]);
  67.             printf("%d %d lineto\n",x,y);
  68.         }
  69.         printf("stroke\nshowpage\n");
  70.     }
  71.     return 0;
  72. }
复制代码
在线编程(http://www.anycodes.cn)&编程论坛(http://www.52exe.cn)感谢您的支持!
回复

使用道具 举报

发布主题 上个主题 下个主题 快速回复 返回列表 官方QQ群
在线客服
客 服 中 心
群 机 器 人
网站二维码
收 起 客 服

QQ|Archiver|手机版|小黑屋|Anycodes ( ICP14002806Anycodes在线编程

GMT+8, 2018-11-15 04:48 , Processed in 1.719953 second(s), 71 queries .

Powered by Anycodes

© 2001-2013 吉林市群龙科技有限公司 Inc.

快速回复 返回顶部 返回列表