湖南大学第二届程序设计大赛赛题分析.PPT

上传人:天*** 文档编号:1060833 上传时间:2018-11-28 格式:PPT 页数:90 大小:244KB
下载 相关 举报
湖南大学第二届程序设计大赛赛题分析.PPT_第1页
第1页 / 共90页
湖南大学第二届程序设计大赛赛题分析.PPT_第2页
第2页 / 共90页
湖南大学第二届程序设计大赛赛题分析.PPT_第3页
第3页 / 共90页
湖南大学第二届程序设计大赛赛题分析.PPT_第4页
第4页 / 共90页
湖南大学第二届程序设计大赛赛题分析.PPT_第5页
第5页 / 共90页
点击查看更多>>
资源描述

1、湖南大学第二届程序设计大赛赛题分析主讲:吴昊Hunan University 2006 the 2nd Programming Contest Array The milliard Vasyas function Computer Robot In The Field Equilateral triangle Fragment Assembly Towards Zero Hamming Distance Overlapping Rectangles James BondProblem A Array Time Limit: 1 second Memory Limit: 32,768 KB De

2、scription (1) Imperative programming languages allow the use of both linear and multi-dimensional arrays. E.g. in Pascal for an array named X the expression array 0.2, 0.1, 0.3 declares a three-dimensional array having the following boundaries for each dimension: 0.2, 0.1, 0.3. (We consider only zer

3、o-based arrays here though other values are possible in Pascal for lower bounds of each dimension.) It is always possible to determine the order in which the items of the array are enumerated. Consider that this order is determined by the principle “right-hand indices change faster“. This means that

4、 the last (rightmost) index iterates through all possible values, then the index that is next to it (second from the right) changes its value by 1, and the last index iterates between the lower and upper boundaries again, and so on.Description(2) Example. The items of the array mentioned above are e

5、numerated in the following order: X0,0,0, X0,0,1, X0,0,2, X0,0,3, X0,1,0, X0,1,1, X0,1,2, X0,1,3, X1,0,0, X1,0,1, X1,0,2, X1,0,3, X1,1,0, X1,1,1, X1,1,2, X1,1,3, X2,0,0, X2,0,1, X2,0,2, X2,0,3, X2,1,0, X2,1,1, X2,1,2, X2,1,3. Let an n-ary array X is declared as array0.k1, 0.k2, ., 0.kn. The theory s

6、ays that the order P of any item Xi1, i2, , in is calculated as P(i1, i2, , in) = 1 + D1*i1+D2*i2+ Dn*in, if we use the enumeration described above. Here D1, D2, ., Dn are so-called index multipliers. Example. For the array in discussion the index multipliers are D1=8, D2=4, D3=1. Then, for example,

7、 the order of X1,0,3 will be P(1,0,3) = 1+8*1+4*0+1*3 = 12. Your task is to calculate the unknown upper boundaries (k1, k2, , kn) for given index multipliers D1, D2, ., Dn and total number of items s in the array.Input The first line of the input contains n the number of dimensions (1 = n = 20) and

8、s the total number of items in the array (1 = s MaxLongInt=231-1). The following n lines contain the index multipliers D1, D2, ., Dn.Output Determine the upper boundaries for each dimension of the array in order: k1, k2, ., kn (0 ki = 1000). The numbers in the output may be delimited with spaces and/or CR/LF characters.Sample Input 3 24 8 4 1Sample Output 2 1 3数组 时间限制 :1S 内存限制 :36728K

展开阅读全文
相关资源
相关搜索
资源标签

当前位置:首页 > 重点行业资料库 > 1

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。