HDOJ1033 Edge

Edge

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 1886    Accepted Submission(s): 1212

Problem Description

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.

Input

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.

Output

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.

Sample Input

V
AVV

Sample Output

300 420 moveto
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

题意太难懂了,水题一道。

#include <stdio.h>
#include <string.h>
char str[202];

int main(){
	int x, y, len, dir;
	while(scanf("%s", str) == 1){
		printf("300 420 moveto\n310 420 lineto\n");
		x = 310; y = 420;
		len = strlen(str);
		dir = 1; //1代表向右,2代表向下,3代表向左,0代表向上
		for(int i = 0; i < len; ++i){
			if(str[i] == ‘A‘){
				switch(dir){
					case 1: y -= 10; break;
					case 2: x -= 10; break;
					case 3: y += 10; break;
					case 0: x += 10;
				}
				dir = (dir + 1) % 4;
			}else{
				switch(dir){
					case 1: y += 10; break;
					case 2: x += 10; break;
					case 3: y -= 10; break;
					case 0: x -= 10;
				}
				dir = (dir + 3) % 4;
			}
			printf("%d %d lineto\n", x, y);
		}
		printf("stroke\nshowpage\n");
	}
	return 0;
}

HDOJ1033 Edge

时间: 2024-10-15 03:28:01

HDOJ1033 Edge的相关文章

判断IE和Edge

//判断是否是IE浏览器,包括Edge浏览器function IEVersion() { var userAgent = navigator.userAgent; if (!!window.ActiveXObject || "ActiveXObject" in window) return "IE"; else if (userAgent.indexOf("Edge") > -1) { return "Edge" } e

Win10正式版除Edge之外 IE等浏览器无法上网的解决办法

重置IE设置,控制面板-网络选项-高级-重置: ? 键盘操作Win+X,或右击开始键: ? 选择"命令提示符(管理员)": ? 按顺序输入下列代码: "Netsh winsock reset" ,回车: "netsh advfirewall reset" ,回车: 完成上述步骤后,关闭命令提示窗口,重启系统即可. 以上就是Win10正式版除Edge之外 IE等浏览器无法上网的解决办法介绍,步骤很简单的,希望能对大家有所帮助!

Windows 10卸载Edge浏览器(不成功的别试了)

在命令行输入: PowerShell dir $env:LOCALAPPDATA\Packages\*edge*^|ren -newname MicrosoftEdge.old ; dir $env:windir\SystemApps\*edge*\AppxManifest.xml ^|Add-AppxPackage -DisableDevelopmentMode -Register ;& mklink /J %PUBLIC%\Desktop\MicrosoftEdge.old %LOCALAP

教你一招:Win10系统如何正确卸载edge浏览器?

Edge浏览器作为Win10系统默认浏览器,尽管我们将其他浏览器设置为默认程序,但是有时候还是会自动弹出,非常的不爽,但是在控制面板中却又找不到卸载“Edge”浏览器的选项.下面小编就教大家卸载“Edge”浏览器的方法. win10卸载edge浏览器的方法:1.按下“Win+x”打开移动中心,在弹出才菜单中点击“命令提示符(管理员)”: 2.在“命令提示符”框中输入以下代码: PowerShell dir $env:LOCALAPPDATA\Packages\*edge*^|ren -newna

推荐一门公开课The Analytics Edge

The Analytics Edge的中文名称应该叫做<数据分析的极限>,来自MITx.这门课最大的特点就是通过各种应用,介绍机器学习和优化的方法,使用的是统计学专用的语言R,所介绍的方法都是最经典的算法.机器学习中,监督学习的算法介绍了线性回归.逻辑回归.决策树与随机森林,非监督学习的算法介绍了分级聚类和K均值聚类:优化的方法介绍了线性优化和整数优化. 课程中很少有数学推导,完全没有介绍各种方法的原理.如果丝毫不了解机器学习的话可以有点难以接受,适合对机器学习有一定了解的人学习.即便我已经学

OpenCV Tutorials &mdash;&mdash; Canny Edge Detector

最好的边缘检测子 Canny algorithm aims to satisfy three main criteria: Low error rate: Meaning a good detection of only existent edges. Good localization: The distance between edge pixels detected and real edge pixels have to be minimized. Minimal response: O

微软为你转向Edge提供了新理由

关于Linux的学习,请参考书籍<Linux就该这么学> 别以为微软只“鼓励” PC 使用者升级 Windows 10,他们还不停的为 Microsoft Edge 浏览器打广告,吸引 PC 使用者从 Google Chrome 或 Firefox 转向Edge的怀抱.他们最新提出的卖点就是 Netflix 了,因为 Edge 跟在 Mac OS 里的 Safari 一样使用 HTML5 播放器,画质最高可达 1080p,Chrome 和 Firefox 则只有最多 720p,而且比特率也更低

&lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=Edge&quot;&gt;

---恢复内容开始--- X-UA-Compatible是自从IE8新加的一个设置,对于IE8以下的浏览器是不识别的.通过在meta中设置X-UA-Compatible的值,可以指定网页的兼容性模式设置. 在网页中指定的模式优先权高于服务器中(通过HTTP Header)所指定的模式. 网页兼容性模式不仅可以在网页上直接设置,还可以在服务器上设置 认识网页兼容性模式 IE8支持几种文件兼容性模式,它们具有不同的特性并影响内容显示的方式. •Emulate IE8 mode指示IE使用<!DOCT

edge 浏览器中数字显示为链接

在win10 中的Edge浏览器中部分格式的数字显示链接.经过各种搜索找到一篇文章 How to remove phone number link on Iphone? ,通过这篇文章了解 edge 浏览器会自动检测符合规则的数字组合为电话号码,并加上链接的样式. 去掉这个默认的功能,在head 中加入 <meta name="format-detection" content="telephone=no"> MSDN中有一篇文章中专门对此作了介绍.Ph