题目英文太多,简单翻译了一下:
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. ReactiveCocoa 谈谈concat

    今天的一个业务流程,业务流程大概就是这样的 1.从CoreData中获取之前的数据 2.更新界面 3.从网络获取数据 4.判断获取结果 5.处理错误判断 6.更新界面 7.判断结果numberOfNe ...

  2. 12天学好C语言——记录我的C语言学习之路(Day 10)

    12天学好C语言--记录我的C语言学习之路 Day 10: 接着昨天的指针部分学习,有这么一个题目: //还是四个学生,四门成绩,只要有学生一门功课没及格就输出这个学生的所有成绩 /*//progra ...

  3. C# 并行开发总结

    本文内容 均参考自 <C#并行高级编程> TPL 支持 数据并行(有大量数据要处理,必须对每个数据执行同样的操作, 任务并行(有好多可以并发运行的操作),流水线(任务并行和数据并行的结合体 ...

  4. 306573704 Char型和string型字符串比较整理(转)

    1.赋值 char赋值: char ch1[] = "give me"; char ch2[] = "a cup"; strcpy(ch1,ch2); cout ...

  5. I Take It All Back: Using Windows Installer (MSI) Rollback Actions

    Original Link: http://blogs.flexerasoftware.com/installtalk/2011/10/i-take-it-all-back-using-windows ...

  6. [Effective Objective-C 读书笔记] 第1章 几条基本写法 (2~5条)

    我的技术博客经常被流氓网站恶意爬取转载.请移步原文:http://www.cnblogs.com/hamhog/p/3575599.html,享受整齐的排版.有效的链接.正确的代码缩进.更好的阅读体验 ...

  7. MFC下拉框使用方法

    Combo Box (组合框)控件很简单,可以节省空间.从用户角度来看,这个控件是由一个文本输入控件和一个下拉菜单组成的.用户可以从一个预先定义的列表里选择一个选项,同时也可以直接在文本框里面输入文本 ...

  8. JDK1.8 HashMap中put源码分析

    一.存储结构      在JDK1.8之前,HashMap采用桶+链表实现,本质就是采用数组+单向链表组合型的数据结构.它之所以有相当快的查询速度主要是因为它是通过计算散列码来决定存储的位置.Hash ...

  9. Java抽奖小程序

    package com.test; import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; im ...

  10. java.util.regx Demo

    import java.util.regex.Matcher;import java.util.regex.Pattern; public class TestRegex { public stati ...