题目英文太多,简单翻译了一下:
1. 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.
    对于那些使用小包包裹的产品,包含所使用方向的包装纸应当折叠起来并且足够小。    
2. We assume that a sheet of paper is rectangular and only folded along lines parallel to its initially shorter edge.
    我们假定包装纸是长方形,并且仅可以沿着平行于初始较短边对折。
3. 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.
    折叠的动作尽管只能沿着一条线,但是却可以沿着两个方向进行:或者将包装纸的顶部折叠在一起,或者将底部折叠在一起。
4. 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.
    两种情况下,长方形都被折叠线分成两部分并且整齐的叠放在一起,这里我们忽略折叠包装纸的厚度差异。
5. 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.
    在经过几次折叠后,我们重新打开包装纸并且观察包装纸的较长边的边缘,它看起来像一维曲线,事实上是级联的线段。
6. 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.
    如果我们沿着曲线的固定方向移动,我们可以将每个折叠区域分类,沿顺时针方向为A,逆时针方向为V。
7. Given such a sequence of classifications, produce a drawing of the longer edge of the sheet assuming 90 degree turns at equidistant places.
    给定这样一个分类序列,在包装纸等距的地方沿给定方向转90度然后画线。
其实非常简单,程序如下:

 #include <stdio.h>
#include <string.h> #define MAXNUM 205
char buf[MAXNUM]; int v_dir[][] = {{, }, {, }, {-, }, {, -}};
int a_dir[][] = {{, }, {, -}, {-, }, {, }}; int setnextdir(int dirs[][], int dir[]) {
int i, index = -; for (i=; i<; ++i)
if (dirs[i][]==dir[] &&dirs[i][]==dir[]) {
index = i;
break;
} if (index >= ) {
index = (index+) & ;
dir[] = dirs[index][];
dir[] = dirs[index][];
return ;
}
return ;
} int main() {
int pos[];
int dir[];
int i; while (scanf("%s", buf) != EOF) {
getchar();
// initial
pos[]=; pos[]=;
dir[]=; dir[]=;
printf("300 420 moveto\n");
pos[] += dir[];
pos[] += dir[];
printf("%d %d lineto\n", pos[], pos[]); for (i=; i<(int)(strlen(buf)); ++i) {
if (buf[i] == 'A')
setnextdir(a_dir, dir);
else
setnextdir(v_dir, dir);
pos[] += dir[];
pos[] += dir[];
printf("%d %d lineto\n", pos[], pos[]);
} printf("stroke\nshowpage\n");
} return ;
}

【HDOJ】1033 Edge的更多相关文章

  1. 【CODEVS】1033 蚯蚓的游戏问题

    [算法]网络流-最小费用最大流(费用流) [题解]与方格取数2类似 在S后添加辅助点S_,限流k 每条边不能重复走,限流1 #include<cstdio> #include<alg ...

  2. 【HDOJ】4729 An Easy Problem for Elfness

    其实是求树上的路径间的数据第K大的题目.果断主席树 + LCA.初始流量是这条路径上的最小值.若a<=b,显然直接为s->t建立pipe可以使流量最优:否则,对[0, 10**4]二分得到 ...

  3. 【hihoCoder】1033: 交错和

    初探数位dp 介绍了数位类统计的基础知识.以下列出其中的基础点: 基本问题 统计在区间[l, r]中满足条件的数的个数 思路 1. [l, r] 将问题转换为 在[0, r]中满足条件的个数 - 在[ ...

  4. 【wikioi】1033 蚯蚓的游戏问题(费用流)

    http://wikioi.com/problem/1033/ 这题也是很水的费用流啊,同之前那题一样,拆点然后建边,容量为1,费用为点权.然后建个源连第一行每个点,容量为1,费用为0,然后最后一行每 ...

  5. 【HDOJ】【3506】Monkey Party

    DP/四边形不等式 裸题环形石子合并…… 拆环为链即可 //HDOJ 3506 #include<cmath> #include<vector> #include<cst ...

  6. 【HDOJ】【3516】Tree Construction

    DP/四边形不等式 这题跟石子合并有点像…… dp[i][j]为将第 i 个点开始的 j 个点合并的最小代价. 易知有 dp[i][j]=min{dp[i][j] , dp[i][k-i+1]+dp[ ...

  7. 【HDOJ】【3480】Division

    DP/四边形不等式 要求将一个可重集S分成M个子集,求子集的极差的平方和最小是多少…… 首先我们先将这N个数排序,容易想到每个自己都对应着这个有序数组中的一段……而不会是互相穿插着= =因为交换一下明 ...

  8. 【HDOJ】【2829】Lawrence

    DP/四边形不等式 做过POJ 1739 邮局那道题后就很容易写出动规方程: dp[i][j]=min{dp[i-1][k]+w[k+1][j]}(表示前 j 个点分成 i 块的最小代价) $w(l, ...

  9. 【HDOJ】【3415】Max Sum of Max-K-sub-sequence

    DP/单调队列优化 呃……环形链求最大k子段和. 首先拆环为链求前缀和…… 然后单调队列吧<_<,裸题没啥好说的…… WA:为毛手写队列就会挂,必须用STL的deque?(写挂自己弱……s ...

随机推荐

  1. 轮子来袭 vJine.Core Orm 之 03_架构分析

    1.vJine.Core ORM 架构: 如上图所示,vJine.Core ORM的特点如下: 所有操作均以DataManager为核心: DataManager业务部分的增删改查操作依赖于Class ...

  2. [.Net MVC] 过滤器以及异常处理

    项目:后台管理平台 意义:程序发布后,不应该对用户显示因程序出错和崩溃而出现的错误信息,采用统一友好的错误页面,并将错误信息记录到日志中供管理人员查看. 一.过滤器Filter Filter(筛选器) ...

  3. struts2的java文件中不能直接弹出script对话框

    需要引入接口 ServletResponseAware public class Login extends ActionSupport implements SessionAware,Servlet ...

  4. Codevs 2611 观光旅游(floyed最小环)

    2611 观光旅游 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Diamond 题目描述 Description 某旅游区里面有N个景点.两个景点之间可能直接有道路相连,用 ...

  5. NOIP200701

    题是这样的: 试题描述 某小学最近得到了一笔赞助,打算拿出其中一部分为学习成绩优秀的前5名学生发奖学金.期末,每个学生都有3门课的成绩:语文.数学.英语.先按总分从高到低排序,如果两个同学总分相同,再 ...

  6. 第36条:坚持使用Override注解

    @Override 注解只能用在方法声明中,表示被注解的方法声明覆盖了超类型中的一个声明. @Target(ElementType.METHOD) @Retention(RetentionPolicy ...

  7. linux系统使用密钥登录设置

    使用密钥登录linux的操作步骤(使用putty): 1.用putty远程登录linux服务器,然后使用puttygen生成密钥,将生成的密钥保存,保存私钥将公钥复制保存到linux服务器的autho ...

  8. ajax、json一些整理(1)

    1.请求text数据,在success事件中手动解析 前台:                 $.ajax({                     type: "post", ...

  9. JSONP(跨域请求) —— 一种非官方跨域数据交互协议

    1.JSONP的作用 由于同源策略的限制,XmlHttpRequest只允许请求当前源(域名.协议.端口)的资源,为 了实现跨域请求,可以通过script标签实现跨域请求,然后再服务器端输出JSON数 ...

  10. 布局时margin会影响父元素

    布局时margin会影响父元素.md 在布局使用margin时 <div class="login-bg"> <div class="login&quo ...