ImageVerifierCode 换一换
格式:DOCX , 页数:15 ,大小:28.97KB ,
资源ID:18007200      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/18007200.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(zoj23922312实验报告英文+翻译.docx)为本站会员(b****1)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

zoj23922312实验报告英文+翻译.docx

1、zoj2392 2312实验报告英文+翻译算法分析大型实验报告编号标题算法题目一2392The Counting Problem模拟题目二2312Japan Plotter Driver模拟班 级:软件1002姓 名:徐潇学 号:201020630222指导老师:赵 端 阳2012年8月The Counting ProblemTime Limit:2 Seconds Memory Limit:65536 KBGiven two integers a and b, we write the numbers between a and b, inclusive, in a list. Your t

2、ask is to calculate the number of occurrences of each digit. For example, if a = 1024 and b = 1032, the list will be1024 1025 1026 1027 1028 1029 1030 1031 1032there are ten 0s in the list, ten 1s, seven 2s, three 3s, and etc.InputThe input consists of up to 500 lines. Each line contains two numbers

3、 a and b where 0 a, b 100000000. The input is terminated by a line 0 0, which is not considered as part of the input.OutputFor each pair of input, output a line containing ten numbers separated by single spaces. The first number is the number of occurrences of the digit 0, the second is the number o

4、f occurrences of the digit 1, etc.Sample Input1 1044 497346 5421199 17481496 14031004 5031714 1901317 8541976 4941001 19600 0Sample Output1 2 1 1 1 1 1 1 1 185 185 185 185 190 96 96 96 95 9340 40 40 93 136 82 40 40 40 40115 666 215 215 214 205 205 154 105 10616 113 19 20 114 20 20 19 19 16107 105 10

5、0 101 101 197 200 200 200 200413 1133 503 503 503 502 502 417 402 412196 512 186 104 87 93 97 97 142 196398 1375 398 398 405 499 499 495 488 471294 1256 296 296 296 296 287 286 286 247【全文翻译】计数问题给定2个整数a和b,在a和b之间写下号码,包含在一个列表里面。你的任务是计算每个数字出现的次数。例如,如果a= 1024,b= 1032,这列数为:1024 1025 1026 1027 1028 1029 10

6、30 1031 1032 有10个零,10个1,7个2,3个3等等。输入输入500行以下。每行包含一个数,其中0 a,b 1 00000000。输入一行是“0 0” 时终止,这是不被视为部分输入。输出对每个输入,输出一行由单个空格分隔的十个数字。第一个是0出现的次数,其次是1,诸如此类。【算法分析】题目:The Counting Problem提交语言:C+运行时间:0ms运行内存:188KB#include #include #include #include #include #include #include using namespace std;#define SZ(v) (int)

7、(v).size()int S,T;int res10,dig20,len;void solve(int Num) Num+; len=0; int temp=1; while(1) dig+len=Num%10; Num/=10; if(!Num) break; temp*=10; for(int i=1;i10;i+) resi+=(len-1)*temp/10; res0+=(len-1)*temp/10-(temp-1)/9; for(int i=1;idiglen;i+) resi+=temp; for(int j=0;j=1;i-) for(int j=0;ji;k-) resdi

8、gk+=temp; resj+=temp; for(int k=0;kT) swap(S,T); solve(S-1); for(int i=0;i10;i+) resi=-resi; solve(T); for(int i=0;i10;i+) printf(i=9?%dn:%d ,resi); return 0;ZOJ Problem Set 2312Japan Plotter DriverTime Limit: 2 Seconds Memory Limit: 65536 KBThe Japan company you are working for produce plotter devi

9、ces that can draw nice pictures. To support customers who do not posses the special hardware, you were asked to write an emulation driver that simulates the work of the plotter and prints the picture on a computer screen.The plotter is driven with a simple language consisting of several drawing comm

10、ands: POINT x y - makes a little circle at the given coordinates. TEXT x y txt - displays a line of text at the given coordinates. LINE x1 y1 x2 y2 - draws a line between the specified points. CLEAR x1 y1 x2 y2 - erases the given rectangle. PRINT - prints an output page and terminates the current jo

11、b.The emulation driver uses few ASCII characters to represent the picture, one character being a basic unit of the coordinate system. The top-left character has coordinates (1,1). The X-axis aims to the right, the Y-axis goes down.The particular commands are emulated as follows: POINT: The driver pu

12、ts a lowercase letter o at the given coordinates. TEXT: Shows a single line of text, the first character is positioned at the given coordinates and the text always goes right. LINE: Simulates a straight line between two points. The line is formed by one of the following characters: dash (-), pipe (|

13、), slash (/), or backslash (), according to its direction. CLEAR: The driver fills the appropriate rectangular area with spaces, including the bounding rows and columns. PRINT: This command causes the driver to print the picture surrounded with a nice frame made of plus (+), minus (-), and pipe (|)

14、characters.If more objects should be drawn across a single character, the following rules apply: If the same character is drawn several times, it is used without a change. If only pipe and minus characters are involved, they result in the plus sign (+). If only slashes and backslashes are involved,

15、the result is the lowercase letter x. Otherwise, the asterisk (*) is displayed.Before a script is given to the driver, it is checked by a special preprocessor, which rejects all invalid commands. Therefore, you may assume that all coordinates are within the range of the page. Also, with the LINE com

16、mand, the two points are always different and the line is strictly either vertical, horizontal, or at the angle of 45o to the axes. There is no assumption on the relative position of the points used with the LINE and CLEAR commands. The text in the TEXT command is always composed only of uppercase l

17、etter and digits.InputThe input consists of several scripts. Each script begins with a line containing two integers X and Y, separated with space, 1 = X, Y = 75. These numbers specify the dimensions of the page. Every other line contains exactly one of the above commands. The commands are always upp

18、ercase, command arguments are separated with one space.The PRINT command is always the last command of the script. After the PRINT command, a new script begins. The input is terminated with two zeros, which are not considered to be a script.OutputFor each script, output the emulated picture, created

19、 as specified above. After the picture, print one blank line.Sample Input20 10LINE 3 2 11 10LINE 3 10 11 2LINE 20 3 8 3TEXT 6 8 TESTLINE 19 1 19 10LINE 17 10 17 1LINE 16 1 16 10LINE 13 6 20 6CLEAR 20 5 15 7LINE 18 1 18 10TEXT 12 10 NICEPICTUREPOINT 1 1POINT 3 2PRINT1 1POINT 1 1CLEAR 1 1 1 1PRINT3 3L

20、INE 2 1 2 3LINE 1 2 3 2LINE 2 3 2 1LINE 3 2 1 2LINE 2 1 2 3LINE 1 2 3 2PRINT0 0Sample Output+-+|o | | * / | | -*-+-| / | | / | | x - | | / | | /TES* | | / | | / NICE*U|+-+-+| |+-+-+| | |-+-| | |+-+【全文翻译】日本绘图仪驱动程序你工作的日本公司生产的绘图设备,能画很好的图。为了支持不具有特殊硬件的客户,你被要求写一个仿真驱动模拟工作的绘图和打印的图像在计算机屏幕上。绘图仪驱动一个包括几个绘图命令简单的

21、语言:POINT x y -在x y处写一个o。TEXT x y txt -从(x , y)开始,向右写入txt。LINE x1 y1 x2 y2 从(x1 , y1) 到 (x2 , y2) 划线。CLEAR x1 y1 x2 y2 -清空矩形区域(用空格填充)。PRINT - 打印输出页并终止当前的工作。仿真驱动程序使用几个ASCII码代表一副图,是一个基本单位的坐标系统。左上角的字坐标(1 , 1)。数据中的x y是以向右延伸为x ,向下延伸为y。特殊命令模拟如下:点:司机把小写字母“o”放在指定坐标。文字:表示一个单一的文本行,第一个字是定位在给定坐标和文字总是向右的。线:模拟两点之间

22、的直线。该线是由以下字符中的一个组成:破折号(“-”),管(“|”),斜杠(“/”),或反斜杠(“”),根据其方向。明确:驱动程序在适当的矩形区域的空间,包括行和列的边界。打印:此命令使驱动程序打印的图片周围有一个漂亮的框架由加(“+”),负(“-”),和管(“|”)字组成。如果一个格子被填了多次,按照如下规则。如果多次填充的都一样,不变。如果只有填充的只有-和|,变为+。如果填充的只有和/,变为小写x。其他情况一律变为*。在脚本放进驱动程序之前,这是检查一个拒绝一切无效命令的特殊预处理。因此,你可以假设所有页面范围内的坐标。此外,在命令行,这两点都是不同的,线是严格垂直,水平,或在45角的轴

23、。没有任何假设的相对位置的点与线和明确的命令。该文本在文本命令总是只由大写字母和数字。此外,在命令行,这两点都是不同的,线是严格垂直,水平,或与轴成45角。没有任何假设的点与线在相对位置有明确的命令。该文本在文本命令中总是只由大写字母和数字组成。输入输入由多个脚本组成。每个脚本开头是一行包括2个整数x与y。分隔空间,1 =,= 75。这些数字在页面有指定尺寸。每一条线都包含一个以上的命令。命令总是大写,命令参数是一个个分离的空间。打印命令总是脚本的最后命令。在打印命令后,一个新的脚本开始了。输入2个零时脚本终止。输出对每个脚本,输出模拟图像,作为上述指定。在图像后,打印一个空行。【算法分析】题

24、目:Japan Plotter Driver提交语言:C+运行时间:0ms运行内存:184KB#include#include#define MAXSIZE 80char mapMAXSIZEMAXSIZE;int sizex,sizey;void setpoint(int x,int y,char c) if(mapyx= )mapyx=c; else if(mapyx=c)return; else if(mapyx=-|mapyx=+|mapyx=|)& (c=-|c=+|c=|)mapyx=+; else if(mapyx=/|mapyx=x|mapyx=)& (c=/|c=|c=x)m

25、apyx=x; else mapyx=*;void line(void) int x1,x2,y1,y2,i; scanf(%d%d%d%d,&x1,&y1,&x2,&y2); if(x1=x2) if(y1y2) i=y1; y1=y2; y2=i; for(i=y1;ix2) i=x1; x1=x2; x2=i; for(i=x1;ix2) i=x1; x1=x2; x2=i; if(y1y2) i=y1; y1=y2; y2=i; while(x1x2) i=x1; x1=x2; x2=i; if(y1y2) i=y1; y1=y2; y2=i; while(x1=x2) setpoin

26、t(x1,y2,/); +x1;-y2; void point(void) int x,y; scanf(%d%d,&x,&y); setpoint(x,y,o);void text(void) int x,y,i; char str1023; scanf(%d%d%s,&x,&y,str); for(i=0;stri&i+xx2) i=x1; x1=x2; x2=i; if(y1y2) i=y1; y1=y2; y2=i; for(i=y1;i=y2;+i)for(j=x1;j=x2;+j)mapij= ;void print(void) int i,j; printf(+); for(i=1;i=sizex;+i)printf(-); printf(+n); for(i=1;i=sizey;+i) printf(|); for(j=1;j=sizex;+j)putchar(mapij); printf(|n); printf(+);

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1