acm论文模板范文

合集下载

由ACM-ICPC引起教与学变化[论文]

由ACM-ICPC引起教与学变化[论文]

由ACM-ICPC引起的教与学的变化介绍了acm-icpc和我校参加竞赛的情况;分析、总结了由组织、培训和参加竞赛引起的教师在教学和科研、学生在学习态度、学习方式及团队协作方面的变化;对赛事的开展提出了的几点建议。

acm-icpc教师变化学生变化一、引言acm-icpc(美国计算机协会-国际大学生程序设计竞赛)是由国际计算机界历史悠久、颇具权威性的组织acm主办的年度性竞赛活动,是世界上公认的规模最大、水平最高的国际大学生程序设计竞赛。

acm-icpc一直受到世界著名的计算机公司的高度重视和赞助。

全球地区赛共分若干个赛区,数十个赛点。

中国大陆从1996年开始设立acm-icpc亚洲区预选赛赛区.2005年以来,各市、省纷纷举行相应的赛事。

目前中国大陆有5个赛区,这极大地促进了这一赛事在该区域的发展。

二、我校围绕acm-icpc所做的工作介绍从2007年初开始到现在,经历了初步尝试、不断探索、走向成熟等阶段。

做的工作概括如下。

(1)定期举行校级比赛,并且使比赛逐步走向正规。

2007年初举行了我校首届程序设计大赛,纸质试卷,人工批阅。

2008年我校借助外校的平台进行了校级比赛。

2010年利用自己研发的竞赛平台举行了校级比赛。

(2)初步开发完成了竞赛和训练平台。

为了使赛事更好地开展,研发了适合我校竞赛和训练平台,该平台能给出哪一组测试数据没能通过,这样大大地方便查错。

(3)组织、指导训练,积极参加各级比赛,并取得了一定的成绩。

从2007年起先后参加了大连市、辽宁省、东北地区的历届acm-icpc大学生程序设计竞赛,以及部分亚洲区网络预选赛,并于2007、2011年成功进入长春和大连赛点的现场决赛。

(4)为了更好地开展竞赛的相关工作,也为了方便指导、训练和相互交流,在相关人员的共同努力下成立了程序设计工作室。

(5)开设了相关的课程。

在进行一段时间的培训,讲课内容逐步趋于成熟,课件和讲义也得到完善,为此面向全校开设了综合素质选修课。

美赛数模论文格式

美赛数模论文格式

美赛数模论文格式篇一:2015年数学建模美赛论文格式2015年美国数学建模要求1( 文章标题居中用宋体142( 第一/第二/第三作者宋体143( 第一作者详细地址,包括国家,电子邮件(宋体11),第二第三作者一样4( 关键词:文章涵盖你论文中的关键词。

这些关键词也会被使用的出版商制作一个关键字索引。

(使用宋体11)5( 对于本文的其余部分,请用宋体126( 摘要:本文档介绍并演示了如何准备你的相机准备手稿跨技术出版物。

最好的是阅读这些说明,并按照该文的轮廓。

7( 文本区为你的稿件必须是宽17厘米,高25厘米(6.7和9.8英寸,RESP)。

请勿超过本区域以外。

使用质量好,约21 X 29 cm或8×11英寸白纸。

您的原稿将约20,减少由出版商。

当设计你的数字和表格等时,请铭记你的原稿将由出版商进行20%的删减。

8( 介绍:所有稿件必须是英文(包括表格和数字)。

请保持您的稿件的第二个副本在你的办公室,以防丢失。

9( 使用斜体强调一个词或短语。

不要用粗体字打字或大写字母除外,对于章节标题(见备注一节的标题,下同)。

使用一台激光打印机,而不是一个矩阵点打印机。

10(文本组织:标题:标题用粗体,首字母大写,其他字母小写。

二级标题作为接下来段落的一部分页码:不要打印页码:请在底部(打字区外)附近的左上角用淡蓝色的铅笔轻轻编号在每一张纸上。

, 脚注:脚注应该是单倍行距和文字分开。

理想地,脚注出现的其参考的页面上,并且被放置在文本的下方,由一个水平线从文本分离。

表格:(参考:表格1,表格2…)应该作为文本的一部分,(用1,2注明)这样做可以避免文档的混淆。

描述性的标题应该置于每个表格之上。

标题应该是自包含的,在表格的下面或者旁边放着。

表格的单位应该用方括号【】注视。

如果方括号无法使用,则用大括号{}或普通括号()图形:(参考图形1,图形2…)也作为文本的一部分,要留下足够的空间让图形的说明不会和文本混淆。

ACM模板

ACM模板
高精度 .......................................................................................................................2 (1)高精函数 ........................................................................................................2 (2)高精开方 ........................................................................................................6 (3)高精类............................................................................................................9 计算几何 .................................................................................................................13 (1)凸包..............................................................................................................13 (2)最远点对 ..............................................................................................

优秀的数学建模论文范文(通用8篇)

优秀的数学建模论文范文(通用8篇)

优秀的数学建模论文范文第1篇摘要:将数学建模思想融入高等数学的教学中来,是目前大学数学教育的重要教学方式。

建模思想的有效应用,不仅显著提高了学生应用数学模式解决实际问题的能力,还在培养大学生发散思维能力和综合素质方面起到重要作用。

本文试从当前高等数学教学现状着手,分析在高等数学中融入建模思想的重要性,并从教学实践中给出相应的教学方法,以期能给同行教师们一些帮助。

关键词:数学建模;高等数学;教学研究一、引言建模思想使高等数学教育的基础与本质。

从目前情况来看,将数学建模思想融入高等教学中的趋势越来越明显。

但是在实际的教学过程中,大部分高校的数学教育仍处在传统的理论知识简单传授阶段。

其教学成果与社会实践还是有脱节的现象存在,难以让学生学以致用,感受到应用数学在现实生活中的魅力,这种教学方式需要亟待改善。

二、高等数学教学现状高等数学是现在大学数学教育中的基础课程,也是一门必修的课程。

他能为其他理工科专业的学生提供很多种解题方式与解题思路,是很多专业,如自动化工程、机械工程、计算机、电气化等必不可少的基础课程。

同时,现实生活中也有很多方面都涉及高数的运算,如,银行理财基金的使用问题、彩票的概率计算问题等,从这些方面都可以看出人们不能仅仅把高数看成是一门学科而已,它还与日常生活各个方面有重要的联系。

但现在很多学校仍以应试教育为主,采取填鸭式教学方式,加上高数的教材并没有与时俱进,将其与生活的关系融入教材内,使学生无法意识到高数的重要性以及高数在日常生活中的魅力,因此产生排斥甚至对抗的心理,只是在临考前突击而已。

因此,对高数进行教学改革是十分有必要的,而且怎么改,怎么让学生发现高数的魅力,并积极主动学习高数也是作为教师所面临的一个重大问题。

三、将数学建模思想融入高等数学的重要性第一,能够激发学生学习高数的兴趣。

建模思想实际上是使用数学语言来对生活中的实际现象进行描述的过程。

把建模思想应用到高等数学的学习中,能够让学生们在日常生活中理解数学的实际应用状况与解决日常生活问题的方便性,让学生们了解到高数并不只是一门课程,而是整个日常生活的基础。

本科毕业论文模板

本科毕业论文模板

本科毕业论文模板篇一:本科毕业论文范文模板题目程序在线评测系统题目程序在线评测系统姓名学号所在学院年级专业指导教师 ** 职称讲师完成时间20xx年月日指导教师评语:评定成绩:指导教师签名:答辩小组意见:评定成绩:答辩小组长签名:综合评定成绩:日期:日期:程序在线评测系统——后台评测模块摘要:ACM国际大学生程序设计竞赛,是一项旨在展示大学生创新能力、团队精神和在压力下编写程序、分析和解决问题能力的年度竞赛。

经过近30多年的发展,ACM国际大学生程序设计竞赛已经发展成为最具影响力的大学生计算机竞赛。

随着其发展,各高校也越来越重视这项竞赛,广东外语外贸大学的程序在线评测系统也应运而生。

在这个平台中,用户只需要提交他们的代码,系统就可以自动地为其程序做出相应的评测,并且返回相应的评测结果。

通过这个平台,用户不但可以巩固学科知识,也可以大大提高代码的实践能力。

后台评测模块主要负责对用户提交的源程序进行编译,运行,得到是评测结果再反馈给用户。

关键词:在线评测,程序设计,ACMOnline Judge System ——Background Judge ModuleCheng Jin Yu School of InformaticsAbstract: ACM international collegiate programming contest, is anannual competition that aims at showing their abilitities of innovation, teamwork, programming under pressure, analysing and solving problems. Through more than 30 years’development, it has become the most influential computing contest for college students and been taken more seriously by many higher eduction universities and colleges, so there comes the Guangdong University of Foreign Studies Online Judge. System which can provide great convenience for programming lovers and students. Users only need to submit their code, then the system can automatically make the appropriate evaluation of its procedures, and returns the corresponding evaluation results. Wiht this platform, users can not only consolidate the academic knowledge, but also can greatly improve the ability of pratical programming.Background judge module is mainly responsible for a user to submit the source code to compile, run, and return the judge result to the user. Key words: Online judge, Programming, ACM目录摘要 .................................................................. .. (I)Abstract ............................................................ ........ II 第一章绪论 (1)1.1 课题的背景、研究意义 (1)1.2 软件开发环境描述 ..................................................... 1 1.3 软件运行环境描述 ..................................................... 2 第二章系统总体设计 (3)2.1 模块介绍 ............................................................. 3 2.2 项目分工 ............................................错误!未定义书签。

ACM的论文写作格式标准

ACM的论文写作格式标准

ACM Word Template for SIG Site1st Author1st author's affiliation1st line of address2nd line of address Telephone number, incl. country code 1st author's E-mail address2nd Author2nd author's affiliation1st line of address2nd line of addressTelephone number, incl. country code2nd E-mail3rd Author3rd author's affiliation1st line of address2nd line of addressTelephone number, incl. country code3rd E-mailABSTRACTA s network speed continues to grow, new challenges of network processing is emerging. In this paper we first studied the progress of network processing from a hardware perspective and showed that I/O and memory systems become the main bottlenecks of performance promotion. Basing on the analysis, we get the conclusion that conventional solutions for reducing I/O and memory accessing latencies are insufficient for addressing the problems.Motivated by the studies, we proposed an improved DCA combined with INIC solution which has creations in optimized architectures, innovative I/O data transferring schemes and improved cache policies. Experimental results show that our solution reduces 52.3% and 14.3% cycles on average for receiving and transmitting respectively. Also I/O and memory traffics are significantly decreased. Moreover, an investigation to the behaviors of I/O and cache systems for network processing is performed. And some conclusions about the DCA method are also presented.KeywordsKeywords are your own designated keywords.1.INTRODUCTIONRecently, many researchers found that I/O system becomes the bottleneck of network performance promotion in modern computer systems [1][2][3]. Aim to support computing intensive applications, conventional I/O system has obvious disadvantages for fast network processing in which bulk data transfer is performed. The lack of locality support and high latency are the two main problems for conventional I/O system, which have been wildly discussed before [2][4].To overcome the limitations, an effective solution called Direct Cache Access (DCA) is suggested by INTEL [1]. It delivers network packages from Network Interface Card (NIC) into cache instead of memory, to reduce the data accessing latency. Although the solution is promising, it is proved that DCA is insufficient to reduce the accessing latency and memory traffic due to many limitations [3][5]. Another effective solution to solve the problem is Integrated Network Interface Card (INIC), which is used in many academic and industrial processor designs [6][7]. INIC is introduced to reduce the heavy burden for I/O registers access in Network Drivers and interruption handling. But recent report [8] shows that the benefit of INIC is insignificant for the state of the art 10GbE network system.In this paper, we focus on the high efficient I/O system design for network processing in general-purpose-processor (GPP). Basing on the analysis of existing methods, we proposed an improved DCA combined with INIC solution to reduce the I/O related data transfer latency.The key contributions of this paper are as follows:▪Review the network processing progress from a hardware perspective and point out that I/O and related last level memory systems have became the obstacle for performance promotion.▪Propose an improved DCA combined with INIC solution for I/O subsystem design to address the inefficient problem of a conventional I/O system.▪Give a framework of the improved I/O system architecture and evaluate the proposed solution with micro-benchmarks.▪Investigate I/O and Cache behaviors in the network processing progress basing on the proposed I/O system.The paper is organized as follows. In Section 2, we present the background and motivation. In Section 3, we describe the improved DCA combined INIC solution and give a framework of the proposed I/O system implementation. In Section 4, firstly we give the experiment environment and methods, and then analyze the experiment results. In Section 5, we show some related works. Finally, in Section 6, we carefully discuss our solutions with many existing technologies, and then draw some conclusions.2.Background and MotivationIn this section, firstly we revise the progress of network processing and the main network performance improvement bottlenecks nowadays. Then from the perspective of computer architecture, a deep analysis of network system is given. Also the motivation of this paper is presented.2.1Network processing reviewFigure 1 illustrates the progress of network processing. Packages from physical line are sampled by Network Interface Card (NIC). NIC performs the address filtering and stream control operations, then send the frames to the socket buffer and notifies OS to invoke network stack processing by interruptions. When OS receives the interruptions, the network stack accesses the data in socket buffer and calculates the checksum. Protocol specific operations are performed layer by layer in stack processing. Finally, data is transferred from socket buffer to the user buffer depended on applications. Commonly this operation is done by memcpy, a system function in OS.Figure 1. Network Processing FlowThe time cost of network processing can be mainly broke down into following parts: Interruption handling, NIC driver, stack processing, kernel routine, data copy, checksum calculation and other overheads. The first 4 parts are considered as packet cost, which means the cost scales with the number of network packets. The rests are considered as bit cost (also called data touch cost), which means the cost is in proportion to the total I/O data size. The proportion of the costs highly depends on the hardware platform and the nature of applications. There are many measurements and analyses about network processing costs [9][10]. Generally, the kernel routine cost ranges from 10% - 30% of the total cycles; the driver and interruption handling costs range from 15% - 35%; the stack processing cost ranges from 7% - 15%; and data touch cost takes up 20% - 35%. With the development of high speed network (e.g. 10/40 Gbps Ethernet), an increasing tendency for kernel routines, driver and interruption handling costs is observed [3].2.2 MotivationTo reveal the relationship among each parts of network processing, we investigate the corresponding hardware operations. From the perspective of computerhardware architecture, network system performance is determined by three domains: CPU speed, Memory speed and I/O speed. Figure 2 depicts the relationship.Figure 2. Network xxxxObviously, the network subsystem can achieve its maximal performance only when the three domains above are in balance. It means that the throughput or bandwidth ofeach hardware domain should be equal with others. Actually this is hard for hardware designers, because the characteristics and physical implementation technologies are different for CPU, Memory and I/O system (chipsets) fabrication. The speed gap between memory and CPU – a.k.a “the memory wall” – has been paid special attention for more than ten years, but still it is not well addressed. Also the disparity between the data throughput in I/O system and the computing capacity provided by CPU has been reported in recent years [1][2].Meanwhile, it is obvious that the major time costs of network processing mentioned above are associated with I/O and Memory speeds, e.g. driver processing, interruption handling, and memory copy costs. The most important nature of network processing is the “producer -consumer locality” between every two consecutive steps of the processing flow. That means the data produced in one hardware unit will be immediately accessed by another unit, e.g. the data in memory which transported from NIC will be accessed by CPU soon. However for conventional I/O and memory systems, the data transfer latency is high and the locality is not exploited.Basing on the analysis discussed above, we get the observation that the I/O and Memory systems are the limitations for network processing. Conventional DCA or INIC cannot successfully address this problem, because it is in-efficient in either I/O transfer latency or I/O data locality utilization (discussed in section 5). To diminish these limitations, we present a combined DCA with INIC solution. The solution not only takes the advantages of both method but also makes many improvements in memory system polices and software strategies.3. Design MethodologiesIn this section, we describe the proposed DCA combined with INIC solution and give a framework of the implementation. Firstly, we present the improved DCA technology and discuss the key points of incorporating it into I/O and Memory systems design. Then, the important software data structures and the details of DCA scheme are given. Finally, we introduce the system interconnection architecture and the integration of NIC.3.1 Improved DCAIn the purpose of reducing data transfer latency and memory traffic in system, we present an improved Direct Cache Access solution. Different with conventional DCA scheme, our solution carefully consider the following points. The first one is cache coherence. Conventionally, data sent from device by DMA is stored in memory only. And for the same address, a different copy of data is stored in cache which usually needs additional coherent unit to perform snoop operation [11]; but when DCA is used, I/O data and CPU data are both stored in cache with one copy for one memory address, shown in figure 4. So our solution modifies the cache policy, which eliminated the snoopingoperations. Coherent operation can be performed by software when needed. This will reduce much memory traffic for the systems with coherence hardware [12].I/O write *(addr) = bCPU write *(addr) = aCacheCPU write *(addr) = a I/O write with DCA*(addr) = bCache(a) cache coherance withconventional I/O(b) cache coherance withDCA I/OFigure 3. xxxxThe second one is cache pollution. DCA is a mixed blessing to CPU: On one side, it accelerates the data transfer; on the other side, it harms the locality of other programs executed in CPU and causes cache pollution. Cache pollution is highly depended on the I/O data size, which is always quite large. E.g. one Ethernet package contains a maximal 1492 bytes normal payload and a maximal 65536 bytes large payload for Large Segment Offload (LSO). That means for a common network buffer (usually 50 ~ 400 packages size), a maximal size range from 400KB to 16MB data is sent to cache. Such big size of data will cause cache performance drop dramatically. In this paper, we carefully investigate the relationship between the size of I/O data sent by DCA and the size of cache system. To achieve the best cache performance, a scheme of DCA is also suggested in section 4. Scheduling of the data sent with DCA is an effective way to improve performance, but it is beyond the scope of this paper.The third one is DCA policy. DCA policy refers the determination of when and which part of the data is transferred with DCA. Obviously, the scheme is application specific and varies with different user targets. In this paper, we make a specific memory address space in system to receive the data transferred with DCA. The addresses of the data should be remapped to that area by user or compilers.3.2 DCA Scheme and detailsTo accelerate network processing, many important software structures used in NIC driver and the stack are coupled with DCA. NIC Descriptors and the associated data buffers are paid special attention in our solution. The former is the data transfer interface between DMA and CPU, and the later contains the packages. For farther research, each package stored in buffer is divided into the header and the payload. Normally the headers are accessed by protocols frequently, but the payload is accessed only once or twice (usually performed as memcpy) in modern network stack and OS. The details of the related software data structures and the network processing progress can be found in previous works [13].The progress of transfer one package from NIC to the stack with the proposed solution is illustrated in Table 1. All the accessing latency parameters in Table 1 are based on a state of the art multi-core processor system [3]. One thing should be noticed is that the cache accessing latency from I/O is nearly the same with that from CPU. But the memory accessing latency from I/O is about 2/3 of that from CPU due to the complex hardware hierarchy above the main memory.Table 1. Table captions should be placed above the tabletransfer.We can see that DCA with INIC solution saves above 95% CPU cycles in theoretical and avoid all the traffic to memory controller. In this paper, we transfer the NIC Descriptors and the data buffers including the headers and payload with DCA to achieve the best performance. But when cache size is small, only transfer the Descriptors and the headers with DCA is an alternative solution.DCA performance is highly depended on system cache policy. Obviously for cache system, write-back with write-allocate policy can help DCA achieves better performance than write-through with write non-allocate policy. Basing on the analysis in section 3.1, we do not use the snooping cache technology to maintain the coherence with memory. Cache coherence for other non-DCA I/O data transfer is guaranteed by software.3.3 On-chip network and integrated NICFootnotes should be Times New Roman 9-point, and justified to the full width of the column.Use the “ACM Reference format” for references – that is, a numbered list at the end of the article, ordered alphabetically and formatted accordingly. See examples of some typical reference types, in the new “ACM Reference format”, at the end of this document. Within this template, use the style named referencesfor the text. Acceptable abbreviations, for journal names, can be found here: /reference/abbreviations/. Word may try to automatically ‘underline’ hotlinks in your references, the correct style is NO underlining.The references are also in 9 pt., but that section (see Section 7) is ragged right. References should be published materials accessible to the public. Internal technical reports may be cited only if they are easily accessible (i.e. you can give the address to obtain thereport within your citation) and may be obtained by any reader. Proprietary information may not be cited. Private communications should be acknowledged, not referenced (e.g., “[Robertson, personal communication]”).3.4Page Numbering, Headers and FootersDo not include headers, footers or page numbers in your submission. These will be added when the publications are assembled.4.FIGURES/CAPTIONSPlace Tables/Figures/Images in text as close to the reference as possible (see Figure 1). It may extend across both columns to a maximum width of 17.78 cm (7”).Captions should be Times New Roman 9-point bold. They should be numbered (e.g., “Table 1” or “Figure 2”), please note that the word for Table and Figure are spelled out. Figure’s captions should be centered beneath the image or picture, and Table captions should be centered above the table body.5.SECTIONSThe heading of a section should be in Times New Roman 12-point bold in all-capitals flush left with an additional 6-points of white space above the section head. Sections and subsequent sub- sections should be numbered and flush left. For a section head and a subsection head together (such as Section 3 and subsection 3.1), use no additional space above the subsection head.5.1SubsectionsThe heading of subsections should be in Times New Roman 12-point bold with only the initial letters capitalized. (Note: For subsections and subsubsections, a word like the or a is not capitalized unless it is the first word of the header.)5.1.1SubsubsectionsThe heading for subsubsections should be in Times New Roman 11-point italic with initial letters capitalized and 6-points of white space above the subsubsection head.5.1.1.1SubsubsectionsThe heading for subsubsections should be in Times New Roman 11-point italic with initial letters capitalized.5.1.1.2SubsubsectionsThe heading for subsubsections should be in Times New Roman 11-point italic with initial letters capitalized.6.ACKNOWLEDGMENTSOur thanks to ACM SIGCHI for allowing us to modify templates they had developed. 7.REFERENCES[1]R. Huggahalli, R. Iyer, S. Tetrick, "Direct Cache Access forHigh Bandwidth Network I/O", ISCA, 2005.[2] D. Tang, Y. Bao, W. Hu et al., "DMA Cache: Using On-chipStorage to Architecturally Separate I/O Data from CPU Data for Improving I/O Performance", HPCA, 2010.[3]Guangdeng Liao, Xia Zhu, Laxmi Bhuyan, “A New ServerI/O Architecture for High Speed Networks,” HPCA, 2011. [4] E. A. Le´on, K. B. Ferreira, and A. B. Maccabe. Reducingthe Impact of the MemoryWall for I/O Using Cache Injection, In 15th IEEE Symposium on High-PerformanceInterconnects (HOTI’07), Aug, 2007.[5] A.Kumar, R.Huggahalli, S.Makineni, “Characterization ofDirect Cache Access on Multi-core Systems and 10GbE”,HPCA, 2009.[6]Sun Niagara 2,/processors/niagara/index.jsp[7]PowerPC[8]Guangdeng Liao, L.Bhuyan, “Performance Measurement ofan Integrated NIC Architecture with 10GbE”, 17th IEEESymposium on High Performance Interconnects, 2009. [9] A.Foong et al., “TCP Performance Re-visited,” IEEE Int’lSymp on Performance Analysis of Software and Systems,Mar 2003[10]D.Clark, V.Jacobson, J.Romkey, and H.Saalwen. “AnAnalysis of TCP processing overhead”. IEEECommunications,June 1989.[11]J.Doweck, “Inside Intel Core microarchitecture and smartmemory access”, Intel White Paper, 2006[12]Amit Kumar, Ram Huggahalli., Impact of Cache CoherenceProtocols on the Processing of Network Traffic[13]Wenji Wu, Matt Crawford, “Potential performancebottleneck in Linux TCP”, International Journalof Communication Systems, Vol. 20, Issue 11, pages 1263–1283, November 2007.[14]Weiwu Hu, Jian Wang, Xiang Gao, et al, “Godson-3: ascalable multicore RISC processor with x86 emulation,”IEEE Micro, 2009. 29(2): pp. 17-29.[15]Cadence Incisive Xtreme Series./products/sd/ xtreme_series.[16]Synopsys GMAC IP./dw/dwtb.php?a=ethernet_mac [17]ler, P.M.Watts, A.W.Moore, "Motivating FutureInterconnects: A Differential Measurement Analysis of PCILatency", ANCS, 2009.[18]Nathan L.Binkert, Ali G.Saidi, Steven K.Reinhardt.Integrated Network Interfaces for High-Bandwidth TCP/IP.Figure 1. Insert caption to place caption below figure.Proceedings of the 12th international conferenceon Architectural support for programming languages and operating systems (ASPLOS). 2006[19]G.Liao, L.Bhuyan, "Performance Measurement of anIntegrated NIC Architecture with 10GbE", HotI, 2009. [20]Intel Server Network I/O Acceleration./technology/comms/perfnet/downlo ad/ServerNetworkIOAccel.pdfColumns on Last Page Should Be Made As Close AsPossible to Equal Length。

基于ACM自动判题系统程序设计实践教学改革论文

基于ACM自动判题系统程序设计实践教学改革论文

基于ACM自动判题系统的程序设计实践教学改革探索摘要:文章针对程序设计传统教学模式存在的不足,提出了基于自动判题系统的实验探索,并总结了其优点和特色,在实际教学中取得了较好的效果。

关键词:acm;自动判题系统;程序设计;教学中图分类号:tp311.1-4 文献标识码:a 文章编号:1007-9599 (2011) 22-0000-02programming practice teaching reform based on acm automatic sub-title systemmei xushi,wang weibin(jinhua vocational and technical college,jinhua 321017,china)abstract:the traditional teaching model for program design shortcomings,proposed a system based on automatic sentence of experiments to explore issues,and summarizes the advantages and features,in the actual teaching and achieved good results.keywords:acm;automatically sentenced to question the system;programming;teachingc语言程序设计、java语言程序设计等课程,作为很多高校计算机大类专业的基础课和必修课,主要在于培养学生掌握程序设计和调试的基本方法,形成程序设计基本思想,使用c/java语言进行基本程序设计的职业能力,在整个专业培养目标中起到了重要的基础支撑作用。

本文针对程序设计传统教学模式存在的不足提出了基于自动判题系统的实验探索,取得了较好的效果。

ACM模板4

ACM模板4

免费模板~~~2010 ACM程序竞赛模板浙江省第七届大学生程序设计竞赛英文队名:Oh,Jack&Rose中文队名:潘多拉星球暴力AC联盟哈嘻嘟2010年4月17日目录一、图论 (1)1.1.最小生成树类prim算法 (1)1.2.拓扑排序 (4)1.3.最短源路径Folyd实现 (5)1.4.关键路径实现算法 (6)1.5.二分图最大匹配的匈牙利算法 (7)1.6.并查集 (9)二、动规 (10)2.1.求最长子序列 (10)2.2.求解最长升序列长度及子序列 (12)2.3.完全背包问题 (13)2.4.0-1背包问题 (14)2.5.母函数DP算法求组合数 (14)2.6.滚动数组求回文串问题 (17)三、贪心 (18)3.1.时间安排问题 (18)3.2.求最大子段和 (19)3.3.贪心求最少非递减序列数 (20)四、数论 (21)4.1.简单求Cnk问题 (21)4.2.巧求阶乘位数 (21)4.3.线性算法求素数 (22)五、其他 (22)5.1.采用位操作递归求解示例 (22)5.2.Stack和Queue用法 (23)5.3.map使用详解 (24)5.4.字典树建立与查找 (24)5.5.KMP匹配算法 (26)5.6.后缀数组求最长连续公共子序列长度 (27)5.7.循环字符串最小位置表示及同构判断 (30)5.8.求哈夫曼树编码长度 (32)5.9.堆排序算法 (34)5.10.线段树着色问题 (35)六、附: (38)6.1.C++最值常量 (38)6.2.类型转换 (39)6.3.String常用函数举例 (39)6.4.C++常用头文件 (40)一、图论1.1.最小生成树类prim算法1.1.1下标从1开始#include<iostream>#include<cstdio>#include<algorithm>using namespace std;#define SIZE 101#define MAXSIZE 10201int n,nline;/*n 个点,nline行关系*/int in[SIZE];struct Point{int x,y;/*编号从1开始*/int v;/*根据实际情况更改类型*/}p[MAXSIZE];/*n*(n-1)/2*/int cmp(Point a,Point b){return a.v<b.v;}int prim(){int dis,count,i,j;memset(in,0,sizeof(in));in[p[1].x]=in[p[1].y]=1;dis=p[1].v;count=n-1;while(count--){/*做n-1次*/for(j=2;j<nline;j++){if((in[p[j].x]&&!in[p[j].y])||(!in[p[j].x]&&in[p[j].y])){in[p[j].x]=1;in[p[j].y]=1;dis+=p[j].v;break;}}}return dis;}int main(){int x,y,v,i;while(scanf("%d",&n)&&n){if(n==1){/*有可能输入的为1个点*/printf("0\n");continue;}nline=n*(n-1)/2+1;for(i=1;i<nline;i++){scanf("%d%d%d",&p[i].x,&p[i].y,&p[i].v);}sort(p+1,p+nline,cmp);printf("%d\n",prim());}return 0;}1.1.2下标从0开始#include<iostream>#include<cstdio>#include<algorithm>using namespace std;#define SIZE 101#define MAXSIZE 10201int n,nline;/*n 个点,nline行关系*/int in[SIZE];struct Point{int x,y;/*编号从1开始*/int v;/*根据实际情况更改类型*/}p[MAXSIZE];/*n*(n-1)/2*/int cmp(Point a,Point b){return a.v<b.v;}int prim(){int dis,count,i,j;memset(in,0,sizeof(in));in[p[0].x]=in[p[0].y]=1;dis=p[0].v;count=n-1;while(count--){/*做n-1次*/for(j=1;j<nline;j++){if((in[p[j].x]&&!in[p[j].y])||(!in[p[j].x]&&in[p[j].y])){in[p[j].x]=1;in[p[j].y]=1;dis+=p[j].v;break;}}}return dis;}int main(){int x,y,v,i;while(scanf("%d",&n)&&n){if(n==1){/*有可能输入的为1个点*/printf("0\n");continue;}nline=n*(n-1)/2;for(i=0;i<nline;i++){scanf("%d%d%d",&p[i].x,&p[i].y,&p[i].v);}sort(p,p+nline,cmp);printf("%d\n",prim());}return 0;}1.2.拓扑排序#include<iostream>#include<cstdio>#include<cstring>#define M 501using namespace std;int map[M][M],degree[M];int ne;/*个数*/void topo(){int i,j,k;for(i=0;i<ne;i++){j=1;while(j<=ne&&degree[j])j++;//直到一个度为零的顶点,这里不检查有多个度为零的情况//if(j>ne){break;}不是拓扑结构if(i)printf(" ");printf("%d",j);degree[j]=-1;for(k=1;k<=ne;k++){degree[k]-=map[j][k];}}printf("\n");}int main(){int a,b,i,j,nline;/*nline行*/while(scanf("%d%d",&ne,&nline)!=EOF){memset(map,0,sizeof(map));memset(degree,0,sizeof(degree));while(nline--){scanf("%d%d",&a,&b);map[a][b]=1;/*a to b*/}for(i=1;i<=ne;i++){for(j=1;j<=ne;j++){if(map[i][j])degree[j]++;}}topo();/*拓扑*/}return 0;}1.3.最短源路径Folyd实现#include<iostream>#include<cstdio>#include<cstring>#define M 201using namespace std;int n,map[M][M],start,end;void folyd(){int i,j,k;for(i=0;i<n;i++){for(j=0;j<n;j++){for(k=0;k<n;k++){if(map[j][i]==-1||map[i][k]==-1)continue;if(map[j][k]==-1||map[j][i]+map[i][k]<map[j][k]){map[j][k]=map[j][i]+map[i][k];}}}}}int main(){int nline,i,j,a,b,v;while(scanf("%d%d",&n,&nline)!=EOF){memset(map,-1,sizeof(map));for(i=0;i<n;i++){map[i][i]=0;}for(i=0;i<nline;i++){scanf("%d%d%d",&a,&b,&v);/*编号从0开始*/if(map[a][b]==-1||map[a][b]>v){//一个点到另一个有多条路map[b][a]=map[a][b]=v;}}scanf("%d%d",&start,&end);folyd();if(map[start][end]!=-1){printf("%d\n",map[start][end]);}else printf("-1\n");}return 0;}1.4.关键路径实现算法#include<iostream>#include<cstdio>#include<cstring>#define M 501using namespace std;int map[M][M],degree[M],dp[M];int ne;/*个数*/int topoplus(){int i,j,k,maxnum;for(i=0;i<ne;i++){j=1;while(j<=ne&&degree[j])j++;//直到一个度为零的顶点,这里不检查有多个度为零的情况//if(j>ne){break;}不是拓扑结构degree[j]=-1;for(k=1;k<=ne;k++){if(map[j][k]){if(map[j][k]+dp[j]>dp[k]){dp[k]=map[j][k]+dp[j];}degree[k]--;}}}for(i=0;i<=ne;i++){if(dp[i]>maxnum){maxnum=dp[i];}}return maxnum;}int main(){int a,b,v,i,j,nline;/*nline行*/while(scanf("%d%d",&ne,&nline)!=EOF){ memset(map,0,sizeof(map));memset(degree,0,sizeof(degree));memset(dp,0,sizeof(dp));while(nline--){scanf("%d%d%d",&a,&b,&v);map[a][b]=v;/*a to b,v>0*/}for(i=1;i<=ne;i++){for(j=1;j<=ne;j++){if(map[i][j])degree[j]++;}}printf("%d\n",topoplus());/*拓扑改进*/ }return 0;}1.5.二分图最大匹配的匈牙利算法#include<iostream>#include<cstdio>#define N 301using namespace std;int isuse[N]; //记录y中节点是否使用int lk[N]; //记录当前与y节点相连的x的节点int mat[N][N];//记录连接x和y的边,如果i和j之间有边则为1,否则为0 int gn,gm; //二分图中x和y中点的数目int can(int t){int i;for(i=1;i<=gm;i++){//下标从1开始if(isuse[i]==0 && mat[t][i]){isuse[i]=1;if(lk[i]==-1 || can(lk[i])){lk[i]=t;return 1;}}}return 0;}int MaxMatch(){int i,num=0;memset(lk,-1,sizeof(lk));for(i=1;i<=gn;i++){memset(isuse,0,sizeof(isuse));if(can(i))num++;}return num;}int main(){int t,i,j,k,tmp;scanf("%d",&t);while(t--){scanf("%d%d",&gn,&gm);memset(mat,0,sizeof(mat));//主要得到mat这个数组for(i=1;i<=gn;i++){scanf("%d",&k);for(j=1;j<=k;j++){scanf("%d",&tmp);mat[i][tmp]=1;//注意从1开始}}if(MaxMatch()==gn){printf("YES\n");}else printf("NO\n");}return 0;}/*In:23 33 1 2 32 1 21 13 32 1 32 1 31 1Out:YESNO*/1.6.并查集#include<iostream>#include<cstdio>using namespace std;const int N=1010;int pre[N];void Merge(int x,int y){int i,t,rx=x,ry=y;while(pre[rx]!=-1)//搜索x的树根 rx=pre[rx];while(pre[ry]!=-1)//搜索y的树根 ry=pre[ry];i=x;//压缩xwhile(pre[i]!=-1){t=pre[i];pre[i]=rx;i=t;}i=y;//压缩ywhile(pre[i]!=-1){t=pre[i];pre[i]=rx;i=t;}if(ry!=rx)//合并pre[ry]=rx;return;}int main(){int x,y,i,ans,n,m;while(scanf("%d",&n)&&n){scanf("%d",&m);memset(pre,-1,sizeof(pre));for(i=0;i<m;i++){//x与y连通scanf("%d %d",&x,&y);Merge(x,y);}ans=0;for(i=1;i<=n;i++)if(pre[i]==-1)ans++;printf("%d\n",ans-1);}}/*/showproblem.php?pid=1232 in:4 21 34 3999 0out:1998*/二、动规2.1.求最长子序列#include<iostream>#include<cstdio>#define M 1001using namespace std;char a[M],b[M];int dp[M+1][M+1],lena,lenb;void init(){int i,j;for(i=0;i<=lena;i++){for(j=0;j<=lenb;j++){dp[i][j]=0;}}}int cmax(int x,int y){return x>y?x:y;}int main(){int i,j,len;while(scanf("%s",a)!=EOF){scanf("%s",b);init();//下面这步很重要,否则会超时lena=strlen(a);lenb=strlen(b);for(i=0;i<lena;i++){for(j=0;j<lenb;j++){if(a[i]==b[j]){dp[i+1][j+1]=dp[i][j]+1;}else{dp[i+1][j+1]=cmax(dp[i][j+1],dp[i+1][j]);}}}//子序列长度printf("%d\n",dp[i][j]);/*打印出子序列*/len=1;for(i=1;i<=lena;i++){for(j=1;j<=lenb;j++){if(len==dp[i][j]){printf("%c",a[i-1]);len++;break;}}}printf("\n");}return 0;}2.2.求解最长升序列长度及子序列#include<iostream>#include<cstdio>#define M 1001using namespace std;int a[M],dp[M];void init(int n){int i;for(i=0;i<n;i++){dp[i]=1;}}int lis(int n){int i,j,maxlen=1;//初始长度为1for(i=n-2;i>=0;i--){for(j=n-1;j>i;j--){if(a[i]<a[j]){if(dp[j]+1>dp[i]){dp[i]=dp[j]+1;}if(dp[i]>maxlen)maxlen=dp[i];}}}return maxlen;}void showlis(int n,int maxlen){int i;for(i=0;i<n;i++){if(dp[i]==maxlen){printf("%d ",a[i]);maxlen--;}}printf("\n");}int main(){int t,n,i,maxlen;scanf("%d",&t);while(t--){/*1<=n<=1000*/scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);}init(n);maxlen=lis(n);printf("%d\n",maxlen);//显示最长升序列showlis(n,maxlen);}return 0;}2.3.完全背包问题#include<iostream>#include<cstring>#include<cstdio>using namespace std;int type[]={150,200,350};//种类int dp[10001];int max(int a,int b){return a>b?a:b;}int main(){int t,n,i,j;scanf("%d",&t);while(t--){scanf("%d",&n);memset(dp,0,sizeof(dp));for(i=0;i<3;i++){for(j=type[i];j<=n;j++){//剩余容量为j时装的东西量最大dp[j]=max(dp[j],dp[j-type[i]]+type[i]);}}printf("%d\n",n-dp[n]);}return 0;}2.4.0-1背包问题#include<iostream>#include<cstdio>#include<cstring>#define M 1002using namespace std;int val[M],wei[M],dp[M][M];int cmax(int a,int b){return a>b?a:b;}int main(){int t,n,w,i,j;scanf("%d",&t);while(t--){scanf("%d%d",&n,&w);for(i=1;i<=n;i++){scanf("%d",&val[i]);}for(i=1;i<=n;i++){scanf("%d",&wei[i]);}memset(dp,0,sizeof(dp));for(i=1;i<=n;i++){for(j=0;j<=w;j++){if(j>=wei[i])dp[i][j]=cmax(dp[i-1][j-wei[i]]+val[i],dp[i-1][j]);else dp[i][j]=dp[i-1][j];}}printf("%d\n",dp[n][w]);}return 0;}2.5.母函数DP算法求组合数2.5.1.求母函数各系数值DP#include <iostream>#define M 17#define MAX 305using namespace std;int c1[MAX],c2[MAX],add[M+1];//add[]保存M种类void init(){int i;for(i=1;i<=M;i++){add[i]=i*i;}}int solve(int n){int i,j,k;//c1[k],c2[k]表示展开式中x^k的系数memset(c1,0,sizeof(c1));memset(c2,0,sizeof(c2));c1[0]=c2[0]=1;//使用前i种币时的情况,也即母函数展开前i个多项式的乘积 for(i=1;i<=M;i++){//求新的多项式中的系数for(j=0;j<n;j++){for(k=1;j+k*add[i]<=n;k++){c2[j+k*add[i]]+=c1[j];}}for(k=0;k<=n;k++){//滚动数组c1[k]=c2[k];}}return c1[n];}int main(){int n;init();while(scanf("%d",&n)&&n){printf("%d\n",solve(n));}return 0;}2.5.2.状态继承类DP求某个和是否存在#include<cstdio>#include<iostream>#include<cstring>using namespace std;bool dp[250002];int val[101],num[101];//对应的值和数量int main(){int n,i,j,sum,k;while(scanf("%d",&n)&&n>0){sum=0;for(i=0;i<n;i++){scanf("%d%d",&val[i],&num[i]);sum+=val[i]*num[i];}//dp中保存所有可能的组合memset(dp,0,sizeof(dp));dp[0]=1;//遍历n种物品for(i=0;i<n;i++){//对区间求for(j=sum/2;j>=0;j--){if(!dp[j]){for(k=1;k<=num[i]&&k*val[i]<=j;k++){dp[j]|=dp[j-k*val[i]];}}}}for(i=sum/2;i>=0;i--){if(dp[i]){printf("%d %d\n",sum-i,i);break;}}}return 0;}/*in:210 120 1310 120 230 1-1out:40 40*/2.6.滚动数组求回文串问题#include<cstdio>#include<iostream>#include<cstring>#define M 5001using namespace std;char str[M],rstr[M];int dp[2][M];//滚动DPint cmax(int x,int y){return x>y?x:y;}int main(){int n,i,j,s1,s2;while(scanf("%d",&n)!=EOF){scanf(" %s",str);//反转字符数组for(i=0;i<n;i++){rstr[n-i-1]=str[i];}rstr[n]='\0';memset(dp,0,sizeof(dp));for(i=0;i<n;i++){for(j=0;j<n;j++){s1=i%2;s2=(i+1)%2;if(str[i]==rstr[j]){dp[s1][j+1]=dp[s2][j]+1;}else{dp[s1][j+1]=cmax(dp[s2][j+1],dp[s1][j]);}}}printf("%d\n",n-dp[(n-1)%2][n]);}return 0;}/*/showproblem.php?pid=15135Ab3bdout:2*/三、贪心3.1.时间安排问题#include<iostream>#include<cstdio>#include<algorithm>#define M 101using namespace std;int n;struct Point{int s,e;}p[M];int cmp(Point a,Point b){if(a.s==b.s)return a.e<b.e;else return a.s<b.s;}int arrange(){int start,end,i,count=1;start=p[0].s;end=p[0].e;for(i=1;i<n;i++){if(p[i].s>=start&&p[i].e<=end){start=p[i].s;end=p[i].e;}else if(p[i].s>=end){count++;end=p[i].e;}}return count;}int main(){int i;while(scanf("%d",&n)&&n){for(i=0;i<n;i++){scanf("%d%d",&p[i].s,&p[i].e);}sort(p,p+n,cmp);printf("%d\n",arrange());}return 0;}3.2.求最大子段和#include<iostream>using namespace std;int main(){int t,n,i,a[100002];int beg,end,x,y,cursum,maxsum;cin>>t;while(t--){cin>>n;for(i=0;i<n;i++){cin>>a[i];}beg=end=1;cursum=maxsum=a[0];x=y=1;for(i=1;i<n;i++){if(a[i]+cursum<a[i]){cursum=a[i];x=i+1;}else{cursum+=a[i];}if(cursum>maxsum){maxsum=cursum;beg=x;end=i+1;}}cout<<maxsum<<" "<<beg<<" "<<end<<endl;}return 0;}/*25 6 -1 5 4 -77 0 6 -1 1 -6 7 -5out:14 1 47 1 6*/3.3.贪心求最少非递减序列数#include<iostream>#include<cstdio>#include<cstring>using namespace std;int a[1001];int main(){int n,i,j,len,count,high;while(scanf("%d",&n)!=EOF){for(i=0;i<n;i++){scanf("%d",&a[i]);}count=0;len=n;while(len){count++;high=30005;//最高值for(i=0;i<n;i++){if(a[i]&&a[i]<high){high=a[i];a[i]=0;//标记已用值len--;}}}printf("%d\n",count);}return 0;}/*in:8 389 207 155 300 299 170 158 65 out:2四、数论4.1.简单求Cnk问题#include<iostream>using namespace std;int main(){int n,k,i;double sum;while(cin>>n>>k){if(n==0&&k==0)break;if(k>n-k)k=n-k;sum=1;for(i=1;i<=k;i++){sum*=(double)(n-k+i)/i*1.000000000001;//必需要乘 }cout<<(int)sum<<endl;}return 0;}4.2.巧求阶乘位数#include<iostream>#include<cmath>using namespace std;const double pi=acos(-1.0);//NOTES:piconst double e=2.71828182845904523536028747135266249775724709369995957; int main(){long long n,tt;cin>>tt;while (tt--){cin>>n;long long ans=(long long)((double)log10(sqrt(2*pi*n))+n*log10(n/e))+1;cout<<ans<<endl;}return 0;}4.3.线性算法求素数const int MAX=10000000;//求[2,MAX]间的素数bool isprime[MAX+1];int prime[MAX];//保存素数//返回素数表元素总数int getprime(){int i,j,pnum=0;//memset(isprime,0,sizeof(isprime));for(i=2;i<=MAX;i++){if(!isprime[i])prime[pnum++]=i;for(j=0;j<pnum&&prime[j]*i<=MAX;j++){isprime[prime[j]*i]=1;if(i%prime[j]==0)break;}}return pnum;}五、其他5.1.采用位操作递归求解示例#include<iostream>#include<cstdio>using namespace std;unsigned short in[50001],ste;/*用16位的ste保存16种状态*/ unsigned short power[]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768}; int n,m,maxnum,i,j;void dfs(int s,int count){if(count>maxnum)maxnum=count;for(i=s;i<m;i++){if(!(ste&in[i])){/*如果相与为0,说明材料未被使用*/ ste=ste|in[i];dfs(i+1,count+1);ste=ste&(~in[i]);}}}int main(){int tn,t;while(scanf("%d%d",&n,&m)!=EOF){if(n==0||m==0){printf("0\n");continue;}for(i=0;i<m;i++){scanf("%d",&tn);in[i]=0;for(j=1;j<=tn;j++){scanf("%d",&t);/*材料编号降为从0开始,防止益处*/in[i]=in[i]|power[t-1];}}ste=0;maxnum=0;dfs(0,0);printf("%d\n",maxnum);}return 0;}5.2.Stack和Queue用法#include<iostream>#include<stack>#include<queue>using namespace std;int main(){stack<int> s;queue<int> q;int a[]={1,2,3,4};/*加入*/for(int i=0;i<4;i++){s.push(a[i]);q.push(a[i]);}/*读取stack*/cout<<"stack-size:"<<s.size()<<endl;for(int i=0;i<4;i++){cout<<s.top()<<" ";s.pop();}cout<<endl<<"queue-size:"<<q.size()<<endl;/*读取queue*/cout<<"front:"<<q.front()<<"back:"<<q.back()<<endl;for(int i=0;i<4;i++){cout<<q.front()<<" ";q.pop();}cout<<endl;return 0;}5.3.map使用详解#include<iostream>#include<map>#include<string>#include<iterator>using namespace std;int main(){map<string,int>m;map<string,int>::iterator p;map<string,int>::reverse_iterator q;m["bd"]=2;m["ba"]=1;m["aa"]=3;m["bd"]=4;//按从小到大遍历for(p=m.begin();p!=m.end();p++){//注意不能使用p<m.end() cout<<p->first<<" "<<p->second<<endl;}//按从大到小遍历for(q=m.rbegin();q!=m.rend();q++){cout<<q->first<<" "<<q->second<<endl;}m.erase(m.begin());cout<<m.size()<<endl;//清楚全部m.clear();cout<<m.empty()<<endl;return 0;}5.4.字典树建立与查找#include<iostream>#include<cstring>#include<cstdio>#define M 26using namespace std;int ii;//只在Tree中使用struct Tree{Tree* next[M];int val;Tree(){for(ii=0;ii<M;ii++){next[ii]=0;}val=0;}~Tree(){for(ii=0;ii<M;ii++){delete(next[ii]);}}};int main(){char word[20];int len,i,j,count;Tree* root=new Tree;Tree* p;//建立字典树过程while(gets(word)){if(strcmp(word,"")==0)break;len=strlen(word);p=root;for(i=0;i<len;i++){j=word[i]-'a';if(p->next[j]==0){p->next[j]=new Tree;}p=p->next[j];(p->val)++;}word[0]='\0';}while(scanf("%s",word)!=EOF){len=strlen(word);p=root;for(i=0;i<len;i++){j=word[i]-'a';if(p->next[j]!=0){p=p->next[j];}else break;}if(i==len)printf("%d\n",p->val);else printf("0\n");}return 0;}/*In:bananabandbeeabsoluteacmbabbandabcout:231*/5.5.KMP匹配算法#include<iostream>#include<cstdio>#include<cstring>#define M 10001using namespace std;int s[M*100],t[M],next[M];//得到next数组,下标均从1开始void getnext(int m){int i=1,j=0;next[1]=0;while(i<=m){if(j==0||t[i]==t[j]){++i;++j;next[i]=j;}else j=next[j];}}//找不到则返回-1int kmp(int n,int m){int i=0,j=1;getnext(m);while(i<=n&&j<=m){if(!j||s[i]==t[j]){++i;++j;}elsej=next[j];}if(j>m)return i-m;else return -1;}int main(){int test,m,n,i;scanf("%d",&test);while(test--){scanf("%d %d",&n,&m);//主串s,长度为nfor(i=1;i<=n;i++)scanf("%d",&s[i]);//横式串t,长度为mfor(i=1;i<=m;i++)scanf("%d",&t[i]);printf("%d\n",kmp(n,m));}return 0;}5.6.后缀数组求最长连续公共子序列长度#include<iostream>#include<cstdio>#include<algorithm>#define M 100001using namespace std;char message[M*2];/*后缀数组*/int height[M*2];int _array[2][M*2];int _rank[2][M*2];int cnt[M*2];int *array, *rank, *narray, *nrank;/*得到最长连续公共子序列长度*/int suffix(int len1,int len2,int len){int i,k;memset(cnt,0,1024);for(i=0;i<len;++i){++cnt[message[i]];}for(i=1;i<= 'z';++i){cnt[i]+=cnt[i-1];}array = _array[0];rank = _rank[0];for(i=len-1;i>=0;--i){array[--cnt[message[i]]]=i;}rank[array[0]] = 0;for(i=1;i<len;i++){rank[array[i]]=rank[array[i-1]];if(message[array[i]]!=message[array[i-1]]){ rank[array[i]]++;}}narray = _array[1];nrank = _rank[1];for(k=1;k<len&&rank[array[len-1]]<len-1;k<<=1){for(i=0;i<len;++i){cnt[rank[array[i]]]=i+1;}for(i=len-1;i>=0;--i){if(array[i] >= k){// array[i]是当前的最大值,所以array[i] - k//是其相同前缀中(rank相同)的最大值narray[--cnt[rank[array[i]-k]]]=array[i]-k;}}for(i=len-k;i<len;++i){//这些没有k后缀,所以他们是最后面的k个,他的位置已经比较出来narray[--cnt[rank[i]]]=i;}nrank[narray[0]] = 0;for (i=1;i<len;++i){nrank[narray[i]]=nrank[narray[i-1]];if(rank[narray[i]]!= rank[narray[i-1]] ||rank[narray[i]+k]!=rank[narray[i-1]+k]){//如果前缀的排名不同,则++;如果前缀相同,但是后缀不同,也++ nrank[narray[i]]++;}}swap(nrank, rank);swap(narray, array);}int ret=0,hei;for(i=1;i<len;++i){if(((array[i]<len1&&array[i-1]>=len1) ||(array[i]>=len1&&array[i-1]<len1))){hei = 0;while(message[array[i]+ hei]==message[array[i-1]+hei]){hei++;}ret = max(ret, hei);}}return ret;}int main(){int len,len1,len2;while(gets(message)!=NULL){len1 = strlen(message);gets(message + len1);len2 = strlen(message+len1);len = len1 + len2;printf("%d\n",suffix(len1,len2,len));}return 0;}5.7.循环字符串最小位置表示及同构判断#include<cstdio>#include<iostream>#include<cstring>#include<string>using namespace std;//返回两个字符串是否同构//len为s1或S2的长度,s1与s2等长//pos1与pos2为字符循环最小表示位置,从0开始bool CircularMatch(string s1, string s2, int len, int& pos1, int& pos2) {int p1 = 0, p2 = 0, k, t1, t2;pos1 = pos2 = -1;while (1) {k = 0;while (1) {t1 = (p1+k)%len; t2 = (p2+k)%len;if(s1[t1] > s2[t2]) {p1 = p1+k+1;if (p1 >= len) return false;break;}else if (s1[t1] < s2[t2]) {p2 = p2+k+1;if (p2 >= len) return false;break;}else k++;if (k == len) {pos1 = p1; pos2 = p2;return true;}}}}//返回字符串循环最小表示的位置,从0开始int MinCircularDenote(string s, int len) {int p1 = 0, p2 = 1, k, t1, t2;while (1) {k = 0;while (1) {t1 = (p1+k)%len; t2 = (p2+k)%len;if(s[t1] > s[t2]) {if (p1+k+1 <= p2) p1 = p2+1;else p1 = p1+k+1;if (p1 >= len) return p2;break;}else if (s[t1] < s[t2]) {if (p2+k+1 <= p1) p2 = p1+1;else p2 = p2+k+1;if (p2 >= len) return p1;break;}else k++;if (k == len)return (p1<p2 ? p1 : p2);}}}//返回字符串循环最大表示的位置,从0开始int MaxCircularDenote(string str,int len) {int p1 = 0, p2 = 1, k, t1, t2;while (1) {k = 0;while (1) {t1 = (p1+k)%len; t2 = (p2+k)%len;if(str[t1] < str[t2]) {if (p1+k+1 <= p2) p1 = p2+1; else p1 = p1+k+1;if (p1 >= len) return p2;break;}else if (str[t1] > str[t2]) {if (p2+k+1 <= p1) p2 = p1+1;else p2 = p2+k+1;if (p2 >= len) return p1;break;}else k++;if (k == len)return (p1<p2 ? p1 : p2);}}}int main(){string s1,s2;int pos1,pos2,len;while(cin>>s1>>s2){len=s1.length();cout<<MinCircularDenote(s1,len)<<endl;cout<<MaxCircularDenote(s1,len)<<endl;s1+=s1;//字符串加倍s2+=s2;cout<<CircularMatch(s1,s2,len, pos1,pos2)<<endl;cout<<pos1<<endl<<pos2<<endl;}return 0;}5.8.求哈夫曼树编码长度#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#define M 27using namespace std;char line[100001];int tree[M],tmp[M];//保存权值int cmp(int a,int b){return a>b;}//对序号为index统计长度int huffman(int n,int index){if(n==1)return 1;//一个点时返回1int i,j,count,max,len,t;for(i=0;i<n;i++){tmp[i]=tree[i];}count=max=n-1;len=0;while(count--){if(index==max||index==max-1){len++;index=max-1;}tmp[max-1]+=tmp[max];j=--max;while(j>0&&tmp[j]>tmp[j-1]){t=tmp[j];tmp[j]=tmp[j-1];tmp[j-1]=t;if(index==j){index--;}else if(index==j-1){index++;}j--;}}return len;}int main(){int i,j,len,sum,n;int ch[M];while(gets(line)!=NULL){if(strcmp(line,"END")==0)break;len=strlen(line);memset(ch,0,sizeof(ch));for(i=0;i<len;i++){if(line[i]=='_'){ch[0]++;}else ch[line[i]-'A'+1]++;}//权值压缩到tree[]数组中for(j=0,i=0;i<M;i++){if(ch[i]){tree[j++]=ch[i];}}n=j;sort(tree,tree+n,cmp);for(sum=0,i=0;i<n;i++){sum+=tree[i]*huffman(n,i);}printf("%d %d %.1lf\n",len*8,sum,len*8.0/(sum*1.0));}return 0;}/*/showproblem.php?pid=1053in:AAAAABCDTHE_CAT_IN_THE_HATENDout:64 13 4.9144 51 2.8*/5.9.堆排序算法#include<cstdio>#include<cstdlib>using namespace std;void adjust(int a[],int s,int len){int t,i;t=a[s];for(i=s*2;i<len;i*=2){if(i<(len-1)&&a[i]<a[i+1])i++;if(t>=a[i])break;a[s]=a[i];s=i;}a[s]=t;}void sort(int a[],int len){int i,t;for(i=(len-1)/2;i>=0;i--){adjust(a,i,len);}for(i=len-1;i>1;i--){t=a[i];a[i]=a[0];a[0]=t;adjust(a,0,i-1);}if(a[0]>a[1]){t=a[0];a[0]=a[1];a[1]=t;}}int main(){int a[1000],i,n;scanf("%d",&n);//for(i=0;i<n;i++)// scanf("%d",a+i);for(i=0;i<n;i++)a[i]=rand()%10000;sort(a,n);for(i=0;i<n;i++)printf("%d ",a[i]);printf("\n");return 0;}//2 38 4 99 10 2 22 1 -43 22 33 91 78 335.10.线段树着色问题#include <iostream>#define N 8003#define NoCol -1#define MulCol -2using namespace std;struct SegTree{int l,r,c;}st[N*4];//一般大小开成节点数的4倍,不需要担心空间问题int seg[N],col[N];int n,sat,end;//创建线段树void segTreeCre(int l,int r,int i=1){int mid;st[i].l=l;st[i].r=r;st[i].c=NoCol;if(l==r){return;}mid=(l+r)/2;。

ACM论文

ACM论文

A Case Study on Computer Security for Non-ExpertComputer UserFelicia DoswellNorfolk State University Computer Science DepartmentNorfolk,VA 23504 (757) 823 - 9453fdoswell@Computer security is a growing concern for many personal computer owners. Cyber crime has been on a constant rise. Many home computer owners don’t realize that they need to pay attention to computer security very closely. This paper describes an investigation on both sides of a cyber attack. We measure the activities of a computer’s inner workings while it is under attack. The intent is to reveal indications that an intrusion has occurred by showing events that occur when a personal computer user’s password has been hacked. With this gained knowledge, a system can be put in place that can alert the user that his/her computer is under an attack. The main goal is to design a system that is easy for any novice computer user to use.Categories and Subject DescriptorsK.4.2 [Social Issues]General TermsSecurityKeywordsComputer Security, Intrusion Detection1. INTRODUCTIONComputer security is part of computer science that studies the capabilities of others gaining access to private data. This aspect of computer science is very prevalent today [11]. Many people are concerned that their data is not protected. There are thieves that steal bandwidth from other patrons. There are criminals that acquire data that they are not authorized to have and even take the identity of another person. Securing your home computer is not a trivial task. Looking at the statistics, people do not take the time to secure the home computer [1]. According to the 2003 CSI/FBI Computer Crime and Security Survey, 56% of the respondents reported unauthorized computer usage. They further state that for the past seven years the average percentage of people who have reported their computers have been hacked has increased (Richardson, 2003). The article continues to emphasize that independent hackers made up 82% of the source of a cyber attack for 2002 and 2003; followed only by disgruntled employees making 18% of the cyber attacks.One of the biggest security holes are weak passwords. With a good password cracker, a hacker can gain unauthorized access to information on a home computer. In addition, many users access corporate machines from these compromised computers resulting in a heightened security threat that can disable a business. This research involves experimenting with exploitations of weak passwords along with a special type of intrusive software called a key logger. The key logger program intrudes upon an unsuspecting computer using the victims own email client program.Some well known ways to ensure your computer’s safet y is to obtain some specialized programs: applying patches, and running anti-viruses, firewall, and file encryption programs [11]. Focusing upon an attack, there are plenty of programs that one can partake of after the attack has occurred [1]. However, the user should become alert as close to the occurrence of the threatening event as possible. This research identifies the anomalies by displaying only relevant system information. Eliminating the overhead of a full detection system allows this to occur in a timely manner and limits overwhelming the novice user with highly technical information. The intrusion detection tool for this project merged various system tools already available on a computer ’s system to alert the user of an attack. Data taken from the computer log files prompt the user that apossible intrusion may have occurred. An important part of this was the design of a simple interface to these tools that extract data meaningful to the home computer user.2.MOTIVATIONNetwork security is the major focus of computer security in the news, but what about the personal home computer? Home PCs are in the same amount of risk as any corporation’s network. With this study, measurements were taken from the initial attack on the home computer. When a program attempts to break a password, the user is notified. This project is necessary to educate people about the current trends of computer security and how they can secure their personal data more efficiently.How can one completely protect their personal computer? Eugene H. Spafford, director of the Purdue Center for Education and Research in Information Assurance and Security states that, "The only truly secure system is one that is powered off, cast in a block of concrete and sealed in a lead-lined room with armed guards - and even then I have my doubts" [7]. Unfortunately, he is not that far from the truth. Overall, the importance of this project can be seen when we understand how the computer reacts to an attack so people are better prepared to handle that situation. It may help the common user realize that their computer has been compromised even if nothing is changed or missing.The motivation for this research is best described with a scenario. A family returns home from vacation. They enter their home; almost everything is as they left it. There is no forced entry; there is no trace that someone has been in the house since they left. The noticeable items such as the television and jewelry are intact and untouched, however, this home as been robbed. One document has been stolen that contained valuable information. How will the owners know that they have been robbed if what was stolen is rarely used? This is a real world example of what can happen when a computer has been compromised. A document, file, or password is stolen unbeknown to the user. The motivation for this project came from factors such as this one. This study shows what information is available to alert the user if such an event occurs.3.RESEARCH QUESTIONSNetworks are extremely vulnerable to attack (Whitson, & Hoffman, June 2003). Some authorities believe it is better to prevent an attack on a computer than not having any protection at all [7]). What happens when a computer is under attack? What commonalities take place upon the computer during an attack? What computer processes can be measured so one will know when one is under attack? What computer statistics are provided by the system that can be measured to detect that an attack has occurred? These questions are answered by performing this research experiment. The results are described in the summary and conclusion. With this new information, the best way to display these anomalies to the general household user is provided. The user is informed that a possible attack has happened.4.BACKGROUND4.1Problem StatementHome computers per household are shortly outnumbering television sets [12]. The home computer is a popular target for intruders [7]. An intruder is a person who attempts to gain unauthorized access to a computer sy stem. “These thieves want personal information to buy and sell the data to the highest bidder” [13]. This is called cyber identity (ID) theft [7]. ID theft has been in every form of the media and on the news since the year 2000. Why are intruders paying attention to home computers? Home computers are typically not very secure and are easy to break into. When combined with high-speed Internet connections that are always turned on, intruders can quickly find and attack home computers. The personal computer is less protected than the network operated and protected computers. Personal data can be stolen from home computers easily if the criminal can break the password and have access to the user’s personal information ([13]. The law enforcers and Internet providers try to protect systems from viruses and spyware, however, it is difficult to protect users from an unseen enemy that may or may not attack [1]? Cyber crime is the fastest growing white-collar crime in the United States [5]. The National Conference of State Legislature cannot accurately measure the number of victims because most victims do not know that they have been victimized yet.4.2Security ThreatHow does an intruder attack a home computer? There are numerous ways, one of which is password cracking. A password cracker is a software program that recovers data and attempts to gain access to a computer system. Another technique of intrusion is sending a virus or spyware. In some instances, an email can contain a virus or spyware. This is also called a Trojan horse. A Trojan horse is a program that unlike a virus contains or installs a malicious program. The victim of an intrusion unknowingly installs it himself or herself. Once installed, the intruder has access to your computer with all system privileges available. Once access is granted a backdoor is typically installed. Backdoors are usually so cleverly disguised that they blend in with the other programs running on a computer. In this project, the backdoor is a key logger program, software that records a persons’ every keystroke. This program was modified to include the capability to send an email with the recorded keystrokes of the user to the intruder, while remaining undetected. Key loggers were originally created to aid in finding the source of errors in a computer system [13]. Intruders have exploited the useful feature to explore weaknesses in computer systems. This research also deals with gaining unauthorized access when the password of a computer is broken. The combination of a password cracker program and the keystroke logger reduces password-guessing effort [10].4.3 Intrusion DetectionIntrusion detection is defined as the act of detecting actions that attempt to compromise the confidentiality, integrity or availability of a resource. This can be performed by examining log files or looking for signs of intrusions, such as suspicious network traffic [8]. A system that performs such tasks is called an intrusion detection system (IDS) [8]. This system captures all data that crosses the systems network and scans for predefined "string signatures, port signatures, and header condition signatures” [8]. These systems identify attacks by analyzing signatures found in packets, system files, processes, and log files much like an anti-virus program [3]. SNORT is one such system that is free open source software. However, this system requires quite a bit of time and effort to learn its usage. Most novice users of computers would not even bother to install this type of system. This research describes the design of such a system geared toward the non-expert computer user.5. PROCEDURES AND METHODOLOGY 5.1 Project DescriptionThe main experiment shows how a computer reacts to an attack on its system. Using statistics gathered by the system, the initial attack was exposed. By accessing the audit log files, data was presented that reveals whether an attack has or has not occurred. There was a simulated attack by a password cracker combined with a key logger. The password cracker used the data given to it by the key logger and attempts to gain unauthorized access to another computer system. The key loggers’ role in this experiment was to assist the password cracker by aiding in the password gathering process. The key logger recorded the user’s keystrokes and periodically sent them to the intruder via email. The password cracker read from the list of text given to it by the key logger and attempts to enter the password. The second part of the experiment was to devise a way to detect the intrusion. There are several tools available to aid in this task; however, the aim is to present the data in a user-friendly manner.5.2 ImplementationThe password cracker and the key logger are the essential part of the intrusion portion of the project. There was source code available for educational use, a key logger. This code did not provide the necessary results required of an emailing key logger nor was its execution hidden from the user. After modification, the executing key logger program is hidden and emails the key logger text to the designated destination.The windows auditing tool was used to retrieve data because it is designed to reveal information about the resources on your computer. However, it provides a great deal of information that can be confusing to understand for the novice computer user. The program to address this issue pulls only the relevant data and displays them to the user. Figure 1 below is a sample audit log file from [4]. Figure 2 describes an abbreviated listing of relevant data to be displayed by the detection tool.Figure 1. Example Audit Log File.Figure 2. Relevant DataJava was used to construct an interface that displays select data from windows auditing tools, net statistics, and open port scanning. An example is shown in Figure 4 below.Figure 3. Example of System Information Screen. Statistics are given with the assistance of PsTools. These are a number of system checking events that are available to any user. There are a series of command-line system calls to the systems’ administrative share. The PsFile, PsLoggedon, and PsLoglist are used in this project. PsFile determines what files are open, and by whom, on the remote system. This is necessary to find any new files or directories created on ones’ system. Any new software must be downloaded and those files will be found with this tool. PsLoggedon shows you who is logged onto a system. This can be either local (interactive) logons or network share logons. Similar to PsFile, this capability is useful to determine who is using your computer resources [4]. This utility will alert the user of any unauthorized users on their server or system. PsLoglist saves windows event logs into a text file and displays that file to the user. These PsTools help the user make an educated decision on whether their computer has been compromised.Open ports are the backdoor that the intruding key logger program uses to receive the users’ keystrokes. The email program exploits that backdoor by mailing the keystroke file to the intruder’s computer. A port is defined as an interface on a computer to which you can connect a device. The port number identifies the type of port being used. For example, port 80 is used for HTTP traffic. The ports that are of concern in this experiment are the incoming and outgoing email ports. Port 110 represents the incoming server (POP3) and port 25 represents the outgoing (SMTP). In this project, TCP/IP and UDP ports were considered along with the mail server port. As stated, parsing through the information and breaking it down into easy understood chunks were the goal of this research.Knowing the functions of ports also assist in pinpointing the intrusion. Therefore, port scanning capability is needed to complete the detection tool. Knowing if a port is open when you did not open it would reveal to the user that their system has been compromised. The combination of these tools assists the user in becoming aware of unauthorized processes and unknown files. The detection software tool does the following functions in an uncomplicated manner:∙Examine Log Files∙Audit for Intrusion Detection∙Look for Unauthorized User Rights∙Check for Odd User Accounts and Groups∙Check All Groups for Unexpected User Membership∙Check for Unauthorized Applications StartingAutomatically∙Check for Unauthorized Shares∙Check for Unauthorized Processes.5.3Experimental MethodsThere are numerous aspects of this project, which involves modification of existing code, development of new code, execution of Microsoft tools, integration of software for hacking and detection and verification that the novice friendly intrusion detection system (NFIDS) is actually an improvement. Two computers were used to emulate the intrusion scenario and the detection scenario. The intruding computer had the password cracker program and the other computer had the anomaly detection software installed. The data that was measured and studied comes from the detection computer.The key logger program was manually placed on the detecting computer. In an actual scenario, the key logger program would have to be downloaded from a website, attached to an email and saved, or copied onto the computer. This program lists every possible key on the keyboard and captures them into a file. After the file is created, the text is dynamically entered into the key logger text file. The function of the key logger is to capture text and avoid detection. To avoid detection, stealth mode was implemented. This hides every screen associated with the program from the victim. Also a task manager exit function was used. If the task manager is opened, the program will shut off and go into sleep mode. The program sleeps for twenty-four hours after which it starts again. How will the intruder gain access to the users’ keystrokes? A mailer function was implemented to send the file via email to a given address. Every twenty-four hours, the key logger program sends an email to its designated destination containing the keystrokes text fileThe password cracker used the text file emailed from the key logger to have a better chance of obtaining the correct password. The password cracker captured every word from the key loggers’ text file until “ENTER” is observed. Each word is entered as a possible password. If access is not granted then the password cracker continues to try words until access is granted or the text file is depleted. The victim’s computer was analyzed for unusual characteristics to determine whether it was compromised.5.4ResultsOnce installed on a computer, the key logger activates. In the task manager, it states that the program is 1,028K in size. While the system is running the CPU usage stays at an average 5.3%. When the program initially starts the CPU usages jumps to 44% then it returns to its average equilibrium. There is no sudden spike in the CPU usage or the CPU usage history while theprogram is running. The file that the key logger creates opens at 0 bytes but quickly increases. The file size increases linearly with the text that is entered by the user. For example, a log file of 10 words is 52 bytes and a log file of 100 words is 2.39 KB. The program defines a word as a succession of characters before the enter key is hit. The formula, f(x) = mx + b, was used as the growth function to validate the linear growth of the keystroke log file. This function notation represents a linear equation with m and b being fixed numbers.The password cracker is used with a remote login program to gain access to the other computer system. The password cracker is 45 KB in size. While using remote login software on the detecting computer, no change was observed when the intruding computer is attempting multiple passwords. Three keystroke text files were used, one with 100 words and the password, the other with 1000 words and the password, and the last with 5000 words and the password. The detecting computer did not notice any change for the multiple attempts.The detection software was tested using 10 subjects that were novice computer users. They were asked to use the system without any instructions. They were only told that they were using security software that alerted them to possible security risks. Eight out of ten were able to use all of the functions of the software without any prompting. The two that did ask questions inquired about the use of the wording of items on the interface. Since this interface was a “quick and dirty” implementation of a detection system, we expected some criticism of the interface. However, the comments confirmed our assumption that input from novice users are required in order to design a user-friendly tool for non-expert computer users of security software. This is a task currently in execution as part of ongoing research.6.CONCLUSIONSThis research demonstrates that it is not a complicated process for someone to hack a computer system. They only need to search the Internet for freely available malicious software and place it on a victim’s computer. Networking provides the transportation mode for disseminating the intrusive software. The key logger program works as intended and emails the logged keystrokes text file. The multiple attempts with a password cracker gave mixed results. My hypothesis was that it would change based on certain states of the computer. Using remote login software to create a connection did not change the victims’ computer processes at all. Change in the computer system is detected only when the password is cracked. Those changes were almost unnoticeable. The novice friendly intrusion detection system (NFIDS) properly detects system anomalies important to a novice user. However, we revealed that the only way to detect the anomaly is after the attack instead of during. The NFIDS did provide the feedback in less time than one of the popular IDS systems, SNORT. The results were also affected by the reporting of small sample of data. Further analysis is needed in order to validate the results with significant confidence.The windows tools allow users to discover if there has been an attack on your system. The PsTools are available for free download and they proved to be very helpful. Finally, knowing the activities of ports provides a way for an average user to determine if their system has been compromised. With the knowledge, a user knows what to look for on their system to verify if their computer has been compromised. The detection tool with the uncomplicated interface was helpful to those who wish to periodically check their system using a combination of tools without having to understand the full output of other well know tools.7.ACKNOWLEDGMENTSThanks goes to Steven Jones for his assistance with this research effort.8.REFERENCES[1]Byers, S. Rubin, D. A. and Kormann, A. (August 2004).Defending against an Internet-based attack on the physicalworld. ACM Transactions on Internet Technology (TOIT), Volume 4 , Issue 3.[2]Drummond, T. (2002). Home Computer Security. CarnegieMellon University.[3]Faulkner, M. (2003). Host Based Intrusion DetectionSystems. The University of Alabama in Huntsville./~faulknmj/660%20tutorial.htm [4]Microsoft Corporation. (2007). How to enable and applysecurity auditing in Windows, Auditing in Windows 2000Server[5]Morton, H. (July 2006). Identity Theft Statutes. Website:/programs/lis/privacy/idt-statutes.htm [6]Richardson, R. (2003) CSI/FBI Computer Crime andSecurity Survey. Website:/gocsi/db_area/pdfs/fbi/FBI2003.pdf [7]Rogers, R. L. (November 2002). Home Computer Security.Retrieved October 12, 2006, from Carnegie MellonSoftware Engineering Institute. Website:/homeusers/HomeComputerSecurity/ [8]Smith, G. (2001). Intrusion Detection Systems. INFS440Emerging Technologies Sciences in Colleges. Volume 18 , Issue 6[9]Spangler, T. (2005). Intrusion Detection and Prevention.Website:/article2/0,1397,1816918,00.as p?kc=BANKT0209KTX1K01[10]Stallings, W. (2005). Operating Systems, Internal andDesign Principles. Fifth Edition. Pearson Education, Inc.[11]Streff, K and Zhou, Z. (February 2006). Developing andenhancing a computer and network security curriculum.Journal of Computing Sciences in Colleges. Volume 21 ,Issue 3[12]Valentine, D. W. (October 2005). Practical computersecurity: a new service course based upon the nationalstrategy to secure cyberspace. Conference on InformationTechnology Education.[13]Whitson, G and Hoffman, L. J. (June 2003). Computersecurity: theory, process and management. Journal ofComputing Sciences in Colleges. Volume 18 , Issue 6。

大学生程序设计竞赛实践论文

大学生程序设计竞赛实践论文

大学生程序设计竞赛研究与实践摘要:阐述了大学生程序设计竞赛背景和竞赛形式,结合高职学生实际情况,通过竞赛活动加强计算机学科教学、学生能力的培养和素质的提高,推动计算机技能应用性创新人才培养。

关键词:acm竞赛;实践教学;创新型人才培养中图分类号:tp311文献标识码:a文章编号:1007-9599 (2011) 24-0000-02research and practice of students programming contest gao hebei(wenzhou vocational&technicalcollege,wenzhou325035,china)abstract:the background and form of the collegiate programming contest is elaborated in this bined with the actual situation of vocational students,the contest strengthens computer science teaching,improves ability and quality of students and promotes the application of creative talent in computer skills.keywords:acm contest;practice teaching;creative talents一、引言acm国际大学生程序设计竞赛(acm international collegiate programming contest,简称acm/icpc)是由acm组织的年度性竞赛,它始于1970年,是全球大学生展示编程能力、解决问题能力和团队合作能力的平台。

1977年举办了首届总决赛,随后每年举办一次国际大学生程序设计竞赛。

ACM的论文写作格式标准

ACM的论文写作格式标准

ACM Word Template for SIG Site1st Author1st author's affiliation1st line of address2nd line of address Telephone number, incl. country code 1st author's E-mail address2nd Author2nd author's affiliation1st line of address2nd line of addressTelephone number, incl. country code2nd E-mail3rd Author3rd author's affiliation1st line of address2nd line of addressTelephone number, incl. country code3rd E-mailABSTRACTA s network speed continues to grow, new challenges of network processing is emerging. In this paper we first studied the progress of network processing from a hardware perspective and showed that I/O and memory systems become the main bottlenecks of performance promotion. Basing on the analysis, we get the conclusion that conventional solutions for reducing I/O and memory accessing latencies are insufficient for addressing the problems.Motivated by the studies, we proposed an improved DCA combined with INIC solution which has creations in optimized architectures, innovative I/O data transferring schemes and improved cache policies. Experimental results show that our solution reduces 52.3% and 14.3% cycles on average for receiving and transmitting respectively. Also I/O and memory traffics are significantly decreased. Moreover, an investigation to the behaviors of I/O and cache systems for network processing is performed. And some conclusions about the DCA method are also presented.KeywordsKeywords are your own designated keywords.1.INTRODUCTIONRecently, many researchers found that I/O system becomes the bottleneck of network performance promotion in modern computer systems [1][2][3]. Aim to support computing intensive applications, conventional I/O system has obvious disadvantages for fast network processing in which bulk data transfer is performed. The lack of locality support and high latency are the two main problems for conventional I/O system, which have been wildly discussed before [2][4].To overcome the limitations, an effective solution called Direct Cache Access (DCA) is suggested by INTEL [1]. It delivers network packages from Network Interface Card (NIC) into cache instead of memory, to reduce the data accessing latency. Although the solution is promising, it is proved that DCA is insufficient to reduce the accessing latency and memory traffic due to many limitations [3][5]. Another effective solution to solve the problem is Integrated Network Interface Card (INIC), which is used in many academic and industrial processor designs [6][7]. INIC is introduced to reduce the heavy burden for I/O registers access in Network Drivers and interruption handling. But recent report [8] shows that the benefit of INIC is insignificant for the state of the art 10GbE network system.In this paper, we focus on the high efficient I/O system design for network processing in general-purpose-processor (GPP). Basing on the analysis of existing methods, we proposed an improved DCA combined with INIC solution to reduce the I/O related data transfer latency.The key contributions of this paper are as follows:▪Review the network processing progress from a hardware perspective and point out that I/O and related last level memory systems have became the obstacle for performance promotion.▪Propose an improved DCA combined with INIC solution for I/O subsystem design to address the inefficient problem of a conventional I/O system.▪Give a framework of the improved I/O system architecture and evaluate the proposed solution with micro-benchmarks.▪Investigate I/O and Cache behaviors in the network processing progress basing on the proposed I/O system.The paper is organized as follows. In Section 2, we present the background and motivation. In Section 3, we describe the improved DCA combined INIC solution and give a framework of the proposed I/O system implementation. In Section 4, firstly we give the experiment environment and methods, and then analyze the experiment results. In Section 5, we show some related works. Finally, in Section 6, we carefully discuss our solutions with many existing technologies, and then draw some conclusions.2.Background and MotivationIn this section, firstly we revise the progress of network processing and the main network performance improvement bottlenecks nowadays. Then from the perspective of computer architecture, a deep analysis of network system is given. Also the motivation of this paper is presented.2.1Network processing reviewFigure 1 illustrates the progress of network processing. Packages from physical line are sampled by Network Interface Card (NIC). NIC performs the address filtering and stream control operations, then send the frames to the socket buffer and notifies OS to invoke network stack processing by interruptions. When OS receives the interruptions, the network stack accesses the data in socket buffer and calculates the checksum. Protocol specific operations are performed layer by layer in stack processing. Finally, data is transferred from socket buffer to the user buffer depended on applications. Commonly this operation is done by memcpy, a system function in OS.Figure 1. Network Processing FlowThe time cost of network processing can be mainly broke down into following parts: Interruption handling, NIC driver, stack processing, kernel routine, data copy, checksum calculation and other overheads. The first 4 parts are considered as packet cost, which means the cost scales with the number of network packets. The rests are considered as bit cost (also called data touch cost), which means the cost is in proportion to the total I/O data size. The proportion of the costs highly depends on the hardware platform and the nature of applications. There are many measurements and analyses about network processing costs [9][10]. Generally, the kernel routine cost ranges from 10% - 30% of the total cycles; the driver and interruption handling costs range from 15% - 35%; the stack processing cost ranges from 7% - 15%; and data touch cost takes up 20% - 35%. With the development of high speed network (e.g. 10/40 Gbps Ethernet), an increasing tendency for kernel routines, driver and interruption handling costs is observed [3].2.2 MotivationTo reveal the relationship among each parts of network processing, we investigate the corresponding hardware operations. From the perspective of computerhardware architecture, network system performance is determined by three domains: CPU speed, Memory speed and I/O speed. Figure 2 depicts the relationship.Figure 2. Network xxxxObviously, the network subsystem can achieve its maximal performance only when the three domains above are in balance. It means that the throughput or bandwidth ofeach hardware domain should be equal with others. Actually this is hard for hardware designers, because the characteristics and physical implementation technologies are different for CPU, Memory and I/O system (chipsets) fabrication. The speed gap between memory and CPU – a.k.a “the memory wall” – has been paid special attention for more than ten years, but still it is not well addressed. Also the disparity between the data throughput in I/O system and the computing capacity provided by CPU has been reported in recent years [1][2].Meanwhile, it is obvious that the major time costs of network processing mentioned above are associated with I/O and Memory speeds, e.g. driver processing, interruption handling, and memory copy costs. The most important nature of network processing is the “producer -consumer locality” between every two consecutive steps of the processing flow. That means the data produced in one hardware unit will be immediately accessed by another unit, e.g. the data in memory which transported from NIC will be accessed by CPU soon. However for conventional I/O and memory systems, the data transfer latency is high and the locality is not exploited.Basing on the analysis discussed above, we get the observation that the I/O and Memory systems are the limitations for network processing. Conventional DCA or INIC cannot successfully address this problem, because it is in-efficient in either I/O transfer latency or I/O data locality utilization (discussed in section 5). To diminish these limitations, we present a combined DCA with INIC solution. The solution not only takes the advantages of both method but also makes many improvements in memory system polices and software strategies.3. Design MethodologiesIn this section, we describe the proposed DCA combined with INIC solution and give a framework of the implementation. Firstly, we present the improved DCA technology and discuss the key points of incorporating it into I/O and Memory systems design. Then, the important software data structures and the details of DCA scheme are given. Finally, we introduce the system interconnection architecture and the integration of NIC.3.1 Improved DCAIn the purpose of reducing data transfer latency and memory traffic in system, we present an improved Direct Cache Access solution. Different with conventional DCA scheme, our solution carefully consider the following points. The first one is cache coherence. Conventionally, data sent from device by DMA is stored in memory only. And for the same address, a different copy of data is stored in cache which usually needs additional coherent unit to perform snoop operation [11]; but when DCA is used, I/O data and CPU data are both stored in cache with one copy for one memory address, shown in figure 4. So our solution modifies the cache policy, which eliminated the snoopingoperations. Coherent operation can be performed by software when needed. This will reduce much memory traffic for the systems with coherence hardware [12].I/O write *(addr) = bCPU write *(addr) = aCacheCPU write *(addr) = a I/O write with DCA*(addr) = bCache(a) cache coherance withconventional I/O(b) cache coherance withDCA I/OFigure 3. xxxxThe second one is cache pollution. DCA is a mixed blessing to CPU: On one side, it accelerates the data transfer; on the other side, it harms the locality of other programs executed in CPU and causes cache pollution. Cache pollution is highly depended on the I/O data size, which is always quite large. E.g. one Ethernet package contains a maximal 1492 bytes normal payload and a maximal 65536 bytes large payload for Large Segment Offload (LSO). That means for a common network buffer (usually 50 ~ 400 packages size), a maximal size range from 400KB to 16MB data is sent to cache. Such big size of data will cause cache performance drop dramatically. In this paper, we carefully investigate the relationship between the size of I/O data sent by DCA and the size of cache system. To achieve the best cache performance, a scheme of DCA is also suggested in section 4. Scheduling of the data sent with DCA is an effective way to improve performance, but it is beyond the scope of this paper.The third one is DCA policy. DCA policy refers the determination of when and which part of the data is transferred with DCA. Obviously, the scheme is application specific and varies with different user targets. In this paper, we make a specific memory address space in system to receive the data transferred with DCA. The addresses of the data should be remapped to that area by user or compilers.3.2 DCA Scheme and detailsTo accelerate network processing, many important software structures used in NIC driver and the stack are coupled with DCA. NIC Descriptors and the associated data buffers are paid special attention in our solution. The former is the data transfer interface between DMA and CPU, and the later contains the packages. For farther research, each package stored in buffer is divided into the header and the payload. Normally the headers are accessed by protocols frequently, but the payload is accessed only once or twice (usually performed as memcpy) in modern network stack and OS. The details of the related software data structures and the network processing progress can be found in previous works [13].The progress of transfer one package from NIC to the stack with the proposed solution is illustrated in Table 1. All the accessing latency parameters in Table 1 are based on a state of the art multi-core processor system [3]. One thing should be noticed is that the cache accessing latency from I/O is nearly the same with that from CPU. But the memory accessing latency from I/O is about 2/3 of that from CPU due to the complex hardware hierarchy above the main memory.Table 1. Table captions should be placed above the tabletransfer.We can see that DCA with INIC solution saves above 95% CPU cycles in theoretical and avoid all the traffic to memory controller. In this paper, we transfer the NIC Descriptors and the data buffers including the headers and payload with DCA to achieve the best performance. But when cache size is small, only transfer the Descriptors and the headers with DCA is an alternative solution.DCA performance is highly depended on system cache policy. Obviously for cache system, write-back with write-allocate policy can help DCA achieves better performance than write-through with write non-allocate policy. Basing on the analysis in section 3.1, we do not use the snooping cache technology to maintain the coherence with memory. Cache coherence for other non-DCA I/O data transfer is guaranteed by software.3.3 On-chip network and integrated NICFootnotes should be Times New Roman 9-point, and justified to the full width of the column.Use the “ACM Reference format” for references – that is, a numbered list at the end of the article, ordered alphabetically and formatted accordingly. See examples of some typical reference types, in the new “ACM Reference format”, at the end of this document. Within this template, use the style named referencesfor the text. Acceptable abbreviations, for journal names, can be found here: /reference/abbreviations/. Word may try to automatically ‘underline’ hotlinks in your references, the correct style is NO underlining.The references are also in 9 pt., but that section (see Section 7) is ragged right. References should be published materials accessible to the public. Internal technical reports may be cited only if they are easily accessible (i.e. you can give the address to obtain thereport within your citation) and may be obtained by any reader. Proprietary information may not be cited. Private communications should be acknowledged, not referenced (e.g., “[Robertson, personal communication]”).3.4Page Numbering, Headers and FootersDo not include headers, footers or page numbers in your submission. These will be added when the publications are assembled.4.FIGURES/CAPTIONSPlace Tables/Figures/Images in text as close to the reference as possible (see Figure 1). It may extend across both columns to a maximum width of 17.78 cm (7”).Captions should be Times New Roman 9-point bold. They should be numbered (e.g., “Table 1” or “Figure 2”), please note that the word for Table and Figure are spelled out. Figure’s captions should be centered beneath the image or picture, and Table captions should be centered above the table body.5.SECTIONSThe heading of a section should be in Times New Roman 12-point bold in all-capitals flush left with an additional 6-points of white space above the section head. Sections and subsequent sub- sections should be numbered and flush left. For a section head and a subsection head together (such as Section 3 and subsection 3.1), use no additional space above the subsection head.5.1SubsectionsThe heading of subsections should be in Times New Roman 12-point bold with only the initial letters capitalized. (Note: For subsections and subsubsections, a word like the or a is not capitalized unless it is the first word of the header.)5.1.1SubsubsectionsThe heading for subsubsections should be in Times New Roman 11-point italic with initial letters capitalized and 6-points of white space above the subsubsection head.5.1.1.1SubsubsectionsThe heading for subsubsections should be in Times New Roman 11-point italic with initial letters capitalized.5.1.1.2SubsubsectionsThe heading for subsubsections should be in Times New Roman 11-point italic with initial letters capitalized.6.ACKNOWLEDGMENTSOur thanks to ACM SIGCHI for allowing us to modify templates they had developed. 7.REFERENCES[1]R. Huggahalli, R. Iyer, S. Tetrick, "Direct Cache Access forHigh Bandwidth Network I/O", ISCA, 2005.[2] D. Tang, Y. Bao, W. Hu et al., "DMA Cache: Using On-chipStorage to Architecturally Separate I/O Data from CPU Data for Improving I/O Performance", HPCA, 2010.[3]Guangdeng Liao, Xia Zhu, Laxmi Bhuyan, “A New ServerI/O Architecture for High Speed Networks,” HPCA, 2011. [4] E. A. Le´on, K. B. Ferreira, and A. B. Maccabe. Reducingthe Impact of the MemoryWall for I/O Using Cache Injection, In 15th IEEE Symposium on High-PerformanceInterconnects (HOTI’07), Aug, 2007.[5] A.Kumar, R.Huggahalli, S.Makineni, “Characterization ofDirect Cache Access on Multi-core Systems and 10GbE”,HPCA, 2009.[6]Sun Niagara 2,/processors/niagara/index.jsp[7]PowerPC[8]Guangdeng Liao, L.Bhuyan, “Performance Measurement ofan Integrated NIC Architecture with 10GbE”, 17th IEEESymposium on High Performance Interconnects, 2009. [9] A.Foong et al., “TCP Performance Re-visited,” IEEE Int’lSymp on Performance Analysis of Software and Systems,Mar 2003[10]D.Clark, V.Jacobson, J.Romkey, and H.Saalwen. “AnAnalysis of TCP processing overhead”. IEEECommunications,June 1989.[11]J.Doweck, “Inside Intel Core microarchitecture and smartmemory access”, Intel White Paper, 2006[12]Amit Kumar, Ram Huggahalli., Impact of Cache CoherenceProtocols on the Processing of Network Traffic[13]Wenji Wu, Matt Crawford, “Potential performancebottleneck in Linux TCP”, International Journalof Communication Systems, Vol. 20, Issue 11, pages 1263–1283, November 2007.[14]Weiwu Hu, Jian Wang, Xiang Gao, et al, “Godson-3: ascalable multicore RISC processor with x86 emulation,”IEEE Micro, 2009. 29(2): pp. 17-29.[15]Cadence Incisive Xtreme Series./products/sd/ xtreme_series.[16]Synopsys GMAC IP./dw/dwtb.php?a=ethernet_mac [17]ler, P.M.Watts, A.W.Moore, "Motivating FutureInterconnects: A Differential Measurement Analysis of PCILatency", ANCS, 2009.[18]Nathan L.Binkert, Ali G.Saidi, Steven K.Reinhardt.Integrated Network Interfaces for High-Bandwidth TCP/IP.Figure 1. Insert caption to place caption below figure.Proceedings of the 12th international conferenceon Architectural support for programming languages and operating systems (ASPLOS). 2006[19]G.Liao, L.Bhuyan, "Performance Measurement of anIntegrated NIC Architecture with 10GbE", HotI, 2009. [20]Intel Server Network I/O Acceleration./technology/comms/perfnet/downlo ad/ServerNetworkIOAccel.pdfColumns on Last Page Should Be Made As Close AsPossible to Equal Length。

ACM课程论文——详解动态规划

ACM课程论文——详解动态规划

暨南大学本科生课程论文论文题目:动态规划算法的应用学院:珠海学院学系:计算机科学系专业:计算机科学与技术课程名称:ACM学生姓名:赵莎学号:2007052391指导教师:陈双平2009年 6 月10 日动态规划算法——试析动态规划算法在ACM中的应用[摘要]通过实例,分析了动态规划算法在ACM中的应用。

[关键词]ACM; 动态规划算法; DPDynamic programming algorithm——Analysis the dynamic programming algorithm in the application of ACM[Abstract] The application of Dynamic programming algorithmhas been studied[Keywords]ACM; Dynamic programming algorithm; DP1.绪论1.1综述[1]动态规划(dynamic programming)是运筹学的一个分支,是求解决策过程(decision process)最优化的数学方法。

20世纪50年代初美国数学家R.E.Bellman等人在研究多阶段决策过程(multistep decision process)的优化问题时,提出了著名的最优化原理(principle of optimality),把多阶段过程转化为一系列单阶段问题,利用各阶段之间的关系,逐个求解,创立了解决这类过程优化问题的新方法——动态规划。

1957年出版了他的名著Dynamic Programming,这是该领域的第一本著作。

动态规划问世以来,在经济管理、生产调度、工程技术和最优控制等方面得到了广泛的应用。

例如最短路线、库存管理、资源分配、设备更新、排序、装载等问题,用动态规划方法比用其它方法求解更为方便。

虽然动态规划主要用于求解以时间划分阶段的动态过程的优化问题,但是一些与时间无关的静态规划(如线性规划、非线性规划),只要人为地引进时间因素,把它视为多阶段决策过程,也可以用动态规划方法方便地求解。

美赛数学建模比赛论文实用模板

美赛数学建模比赛论文实用模板

The Keep-Right-Except-To-Pass RuleSummaryAs for the first question, it provides a traffic rule of keep right except to pass, requiring us to verify its effectiveness. Firstly, we define one kind of traffic rule different from the rule of the keep right in order to solve the problem clearly; then, we build a Cellular automaton model and a Nasch model by collecting massive data; next, we make full use of the numerical simulation according to several influence factors of traffic flow; At last, by lots of analysis of graph we obtain, we indicate a conclusion as follow: when vehicle density is lower than 0.15, the rule of lane speed control is more effective in terms of the factor of safe in the light traffic; when vehicle density is greater than 0.15, so the rule of keep right except passing is more effective In the heavy traffic.As for the second question, it requires us to testify that whether the conclusion we obtain in the first question is the same apply to the keep left rule. First of all, we build a stochastic multi-lane traffic model; from the view of the vehicle flow stress, we propose that the probability of moving to the right is 0.7and to the left otherwise by making full use of the Bernoulli process from the view of the ping-pong effect, the conclusion is that the choice of the changing lane is random. On the whole, the fundamental reason is the formation of the driving habit, so the conclusion is effective under the rule of keep left.As for the third question, it requires us to demonstrate the effectiveness of the result advised in the first question under the intelligent vehicle control system. Firstly, taking the speed limits into consideration, we build a microscopic traffic simulator model for traffic simulation purposes. Then, we implement a METANET model for prediction state with the use of the MPC traffic controller. Afterwards, we certify that the dynamic speed control measure can improve the traffic flow .Lastly neglecting the safe factor, combining the rule of keep right with the rule of dynamical speed control is the best solution to accelerate the traffic flow overall.Key words:Cellular automaton model Bernoulli process Microscopic traffic simulator model The MPC traffic controlContentContent (2)1. Introduction (3)2. Analysis of the problem (3)3. Assumption (3)4. Symbol Definition (3)5. Models (4)5.1 Building of the Cellular automaton model (4)5.1.1 Verify the effectiveness of the keep right except to pass rule (4)5.1.2 Numerical simulation results and discussion (5)5.1.3 Conclusion (8)5.2 The solving of second question (8)5.2.1 The building of the stochastic multi-lane traffic model (9)5.2.2 Conclusion (9)5.3 Taking the an intelligent vehicle system into a account (9)5.3.1 Introduction of the Intelligent Vehicle Highway Systems (9)5.3.2 Control problem (9)5.3.3 Results and analysis (9)5.3.4 The comprehensive analysis of the result (10)6. Improvement of the model (11)6.1 strength and weakness (11)6.1.1 Strength (11)6.1.2 Weakness (11)6.2 Improvement of the model (11)7. Reference (13)1. IntroductionAs is known to all, it’s essential for us to drive automobiles, thus the driving rules is crucial important. In many countries like USA, China, drivers obey the rules which called “The Keep-Right-Except-To-Pass (that is, when driving automobiles, the rule requires drivers to drive in the right-most unless theyare passing another vehicle)”.2. Analysis of the problemFor the first question, we decide to use the Cellular automaton to build models,then analyze the performance of this rule in light and heavy traffic. Firstly,we mainly use the vehicle density to distinguish the light and heavy traffic; secondly, we consider the traffic flow and safe as the represent variable which denotes the light or heavy traffic; thirdly, we build and analyze a Cellular automaton model; finally, we judge the rule through two different driving rules,and then draw conclusions.3. AssumptionIn order to streamline our model we have made several key assumptions●The highway of double row three lanes that we study can representmulti-lane freeways.●The data that we refer to has certain representativeness and descriptive●Operation condition of the highway not be influenced by blizzard oraccidental factors●Ignore the driver's own abnormal factors, such as drunk driving andfatigue driving●The operation form of highway intelligent system that our analysis canreflect intelligent system●In the intelligent vehicle system, the result of the sampling data hashigh accuracy.4. Symbol Definitioni The number of vehiclest The time5. ModelsBy analyzing the problem, we decided to propose a solution with building a cellular automaton model.5.1 Building of the Cellular automaton modelThanks to its simple rules and convenience for computer simulation, cellular automaton model has been widely used in the study of traffic flow in recent years. Let )(t x i be the position of vehicle i at time t , )(t v i be the speed of vehicle i at time t , p be the random slowing down probability, and R be the proportion of trucks and buses, the distance between vehicle i and the front vehicle at time t is:1)()(1--=-t x t x gap i i i , if the front vehicle is a small vehicle.3)()(1--=-t x t x gap i i i , if the front vehicle is a truck or bus.5.1.1 Verify the effectiveness of the keep right except to pass ruleIn addition, according to the keep right except to pass rule, we define a new rule called: Control rules based on lane speed. The concrete explanation of the new rule as follow:There is no special passing lane under this rule. The speed of the first lane (the far left lane) is 120–100km/h (including 100 km/h);the speed of the second lane (the middle lane) is 100–80km8/h (including80km/h);the speed of the third lane (the far right lane) is below 80km/ h. The speeds of lanes decrease from left to right.● Lane changing rules based lane speed controlIf vehicle on the high-speed lane meets control v v <, ),1)(min()(max v t v t gap i f i +≥, safe b i gap t gap ≥)(, the vehicle will turn into the adjacent right lane, and the speed of the vehicle after lane changing remains unchanged, where control v is the minimum speed of the corresponding lane.● The application of the Nasch model evolutionLet d P be the lane changing probability (taking into account the actual situation that some drivers like driving in a certain lane, and will not takethe initiative to change lanes), )(t gap f i indicates the distance between the vehicle and the nearest front vehicle, )(t gap b i indicates the distance between the vehicle and the nearest following vehicle. In this article, we assume that the minimum safe distance gap safe of lane changing equals to the maximum speed of the following vehicle in the adjacent lanes.Lane changing rules based on keeping right except to passIn general, traffic flow going through a passing zone (Fig. 5.1.1) involves three processes: the diverging process (one traffic flow diverging into two flows), interacting process (interacting between the two flows), and merging process (the two flows merging into one) [4].Fig.5.1.1 Control plan of overtaking process(1) If vehicle on the first lane (passing lane) meets ),1)(min()(max v t v t gap i f i +≥ and safe b i gap t gap ≥)(, the vehicle will turn into the second lane, the speed of the vehicle after lane changing remains unchanged.5.1.2 Numerical simulation results and discussionIn order to facilitate the subsequent discussions, we define the space occupation rate as L N N p truck CAR ⨯⨯+=3/)3(, where CAR N indicates the number ofsmall vehicles on the driveway,truck N indicates the number of trucks and buses on the driveway, and L indicates the total length of the road. The vehicle flow volume Q is the number of vehicles passing a fixed point per unit time,T N Q T /=, where T N is the number of vehicles observed in time duration T .The average speed ∑∑⨯=T it i a v T N V 11)/1(, t i v is the speed of vehicle i at time t . Take overtaking ratio f p as the evaluation indicator of the safety of traffic flow, which is the ratio of the total number of overtaking and the number of vehicles observed. After 20,000 evolution steps, and averaging the last 2000 steps based on time, we have obtained the following experimental results. In order to eliminate the effect of randomicity, we take the systemic average of 20 samples [5].Overtaking ratio of different control rule conditionsBecause different control conditions of road will produce different overtaking ratio, so we first observe relationships among vehicle density, proportion of large vehicles and overtaking ratio under different control conditions.(a) Based on passing lane control (b) Based on speed control Fig.5.1.3Fig.5.1.3 Relationships among vehicle density, proportion of large vehicles and overtaking ratio under different control conditions.It can be seen from Fig. 5.1.3:(1) when the vehicle density is less than 0.05, the overtaking ratio will continue to rise with the increase of vehicle density; when the vehicle density is larger than 0.05, the overtaking ratio will decrease with the increase of vehicle density; when density is greater than 0.12, due to the crowding, it willbecome difficult to overtake, so the overtaking ratio is almost 0.(2) when the proportion of large vehicles is less than 0.5, the overtaking ratio will rise with the increase of large vehicles; when the proportion of large vehicles is about 0.5, the overtaking ratio will reach its peak value; when the proportion of large vehicles is larger than 0.5, the overtaking ratio will decrease with the increase of large vehicles, especially under lane-based control condition s the decline is very clear.● Concrete impact of under different control rules on overtaking ratioFig.5.1.4Fig.5.1.4 Relationships among vehicle density, proportion of large vehicles and overtaking ratio under different control conditions. (Figures in left-hand indicate the passing lane control, figures in right-hand indicate the speed control. 1f P is the overtaking ratio of small vehicles over large vehicles, 2f P is the overtaking ratio of small vehicles over small vehicles, 3f P is the overtaking ratio of large vehicles over small vehicles, 4f P is the overtaking ratio of large vehicles over large vehicles.). It can be seen from Fig. 5.1.4:(1) The overtaking ratio of small vehicles over large vehicles under passing lane control is much higher than that under speed control condition, which is because, under passing lane control condition, high-speed small vehicles have to surpass low-speed large vehicles by the passing lane, while under speed control condition, small vehicles are designed to travel on the high-speed lane, there is no low- speed vehicle in front, thus there is no need to overtake.● Impact of different control rules on vehicle speedFig. 5.1.5 Relationships among vehicle density, proportion of large vehicles and average speed under different control conditions. (Figures in left-hand indicates passing lane control, figures in right-hand indicates speed control.a X is the average speed of all the vehicles, 1a X is the average speed of all the small vehicles, 2a X is the average speed of all the buses and trucks.).It can be seen from Fig. 5.1.5:(1) The average speed will reduce with the increase of vehicle density and proportion of large vehicles.(2) When vehicle density is less than 0.15,a X ,1a X and 2a X are almost the same under both control conditions.Effect of different control conditions on traffic flowFig.5.1.6Fig. 5.1.6 Relationships among vehicle density, proportion of large vehicles and traffic flow under different control conditions. (Figure a1 indicates passing lane control, figure a2 indicates speed control, and figure b indicates the traffic flow difference between the two conditions.It can be seen from Fig. 5.1.6:(1) When vehicle density is lower than 0.15 and the proportion of large vehicles is from 0.4 to 1, the traffic flow of the two control conditions are basically the same.(2) Except that, the traffic flow under passing lane control condition is slightly larger than that of speed control condition.5.1.3 ConclusionIn this paper, we have established three-lane model of different control conditions, studied the overtaking ratio, speed and traffic flow under different control conditions, vehicle density and proportion of large vehicles.5.2 The solving of second question5.2.1 The building of the stochastic multi-lane traffic model5.2.2 ConclusionOn one hand, from the analysis of the model, in the case the stress is positive, we also consider the jam situation while making the decision. More specifically, if a driver is in a jam situation, applying ))(,2(x P B R results with a tendency of moving to the right lane for this driver. However in reality, drivers tend to find an emptier lane in a jam situation. For this reason, we apply a Bernoulli process )7.0,2(B where the probability of moving to the right is 0.7and to the left otherwise, and the conclusion is under the rule of keep left except to pass, So, the fundamental reason is the formation of the driving habit.5.3 Taking the an intelligent vehicle system into a accountFor the third question, if vehicle transportation on the same roadway was fully under the control of an intelligent system, we make some improvements for the solution proposed by us to perfect the performance of the freeway by lots of analysis.5.3.1 Introduction of the Intelligent Vehicle Highway SystemsWe will use the microscopic traffic simulator model for traffic simulation purposes. The MPC traffic controller that is implemented in the Matlab needs a traffic model to predict the states when the speed limits are applied in Fig.5.3.1. We implement a METANET model for prediction purpose[14].5.3.2 Control problemAs a constraint, the dynamic speed limits are given a maximum and minimum allowed value. The upper bound for the speed limits is 120 km/h, and the lower bound value is 40 km/h. For the calculation of the optimal control values, all speed limits are constrained to this range. When the optimal values are found, they are rounded to a multiplicity of 10 km/h, since this is more clear for human drivers, and also technically feasible without large investments.5.3.3 Results and analysisWhen the density is high, it is more difficult to control the traffic, since the mean speed might already be below the control speed. Therefore, simulations are done using densities at which the shock wave can dissolve without using control, and at densities where the shock wave remains. For each scenario, five simulations for three different cases are done, each with a duration of one hour. The results of the simulations are reported in Table 5.1, 5.2, 5.3. Table.5.1 measured results for the unenforced speed limit scenariodem q case#1 #2 #3 #4 #5 TTS:mean(std ) TPN 4700no shock 494.7452.1435.9414.8428.3445.21(6.9%) 5:4wave 3 5 8 8 0 14700nocontrolled520.42517.48536.13475.98539.58517.92(4.9%)6:364700 controlled 513.45488.43521.35479.75-486.5500.75(4.0%)6:244700 no shockwave493.9472.6492.78521.1489.43493.96(3.5%)6:034700 uncontrolled635.1584.92643.72571.85588.63604.84(5.3%)7:244700 controlled 575.3654.12589.77572.15586.46597.84(6.4%)7:19●Enforced speed limits●Intelligent speed adaptationFor the ISA scenario, the desired free-flow speed is about 100% of the speed limit. The desired free-flow speed is modeled as a Gaussian distribution, with a mean value of 100% of the speed limit, and a standard deviation of 5% of the speed limit. Based on this percentage, the influence of the dynamic speed limits is expected to be good[19].5.3.4 The comprehensive analysis of the resultFrom the analysis above, we indicate that adopting the intelligent speed control system can effectively decrease the travel times under the control of an intelligent system, in other words, the measures of dynamic speed control can improve the traffic flow.Evidently, under the intelligent speed control system, the effect of the dynamic speed control measure is better than that under the lane speed control mentioned in the first problem. Because of the application of the intelligent speed control system, it can provide the optimal speed limit in time. In addition, it can guarantee the safe condition with all kinds of detection device and the sensor under the intelligent speed system.On the whole, taking all the analysis from the first problem to the end into a account, when it is in light traffic, we can neglect the factor of safe with the help of the intelligent speed control system.Thus, under the state of the light traffic, we propose a new conclusion different from that in the first problem: the rule of keep right except to pass is more effective than that of lane speed control.And when it is in the heavy traffic, for sparing no effort to improve the operation efficiency of the freeway, we combine the dynamical speed control measure with the rule of keep right except to pass, drawing a conclusion that the application of the dynamical speed control can improve the performance ofthe freeway.What we should highlight is that we can make some different speed limit as for different section of road or different size of vehicle with the application of the Intelligent Vehicle Highway Systems.In fact, that how the freeway traffic operate is extremely complex, thereby, with the application of the Intelligent Vehicle Highway Systems, by adjusting our solution originally, we make it still effective to freeway traffic.6. Improvement of the model6.1 strength and weakness6.1.1 Strength●it is easy for computer simulating and can be modified flexibly to consideractual traffic conditions ,moreover a large number of images make the model more visual.●The result is effectively achieved all of the goals we set initially, meantimethe conclusion is more persuasive because of we used the Bernoulli equation.●We can get more accurate result as we apply Matlab.6.1.2 Weakness●The relationship between traffic flow and safety is not comprehensivelyanalysis.●Due to there are many traffic factors, we are only studied some of the factors,thus our model need further improved.6.2 Improvement of the modelWhile we compare models under two kinds of traffic rules, thereby we come to the efficiency of driving on the right to improve traffic flow in some circumstance. Due to the rules of comparing is too less, the conclusion is inadequate. In order to improve the accuracy, We further put forward a kinds of traffic rules: speed limit on different type of cars.The possibility of happening traffic accident for some vehicles is larger, and it also brings hidden safe troubles. So we need to consider separately about different or specific vehicle types from the angle of the speed limiting in order to reduce the occurrence of traffic accidents, the highway speed limit signs is in Fig.6.1.Fig .6.1Advantages of the improving model are that it is useful to improve the running condition safety of specific type of vehicle while considering the difference of different types of vehicles. However, we found that the rules may be reduce the road traffic flow through the analysis. In the implementation it should be at the 85V speed of each model as the main reference basis. In recent years, the 85V of some researchers for the typical countries from Table 6.1[ 21]: Table 6.1 Operating speed prediction modeAuthorCountry Model Ottesen andKrammes2000America LC DC L DC V C ⨯---=01.0012.057.144.10285Andueza2000Venezuel a ].[308.9486.7)/894()/2795(25.9885curve horizontal L DC Ra R V T ++--= ].[tan 819.27)/3032(69.10085gent L R V T +-= Jessen2001 America ][00239.0614.0279.080.86185LSD ADT G V V P --+=][00212.0432.010.7285NLSD ADT V V P -+=Donnell2001 America 22)2(8500724.040.10140.04.78T L G R V --+=22)3(85008369.048.10176.01.75T L G R V --+= 22)4(8500810.069.10176.05.74T L G R V --+=22)5(8500934.008.21.83T L G V --=BucchiA.BiasuzziK.And SimoneA.2005Italy DC V 124.0164.6685-= DC E V 4.046.3366.5585--= 2855.035.1119.0745.65DC E DC V ---= Fitzpatrick America KV 98.17507.11185-= Meanwhile, there are other vehicles driving rules such as speed limit in adverseweather conditions. This rule can improve the safety factor of the vehicle to some extent. At the same time, it limits the speed at the different levels.7. Reference[1] M. Rickert, K. Nagel, M. Schreckenberg, A. Latour, Two lane traffi csimulations using cellular automata, Physica A 231 (1996) 534–550.[20] J.T. Fokkema, Lakshmi Dhevi, Tamil Nadu Traffi c Management and Control inIntelligent Vehicle Highway Systems,18(2009).[21] Yang Li, New Variable Speed Control Approach for Freeway. (2011) 1-66。

ACM(五篇范例)

ACM(五篇范例)

ACM(五篇范例)第一篇:ACMDijkstra 模板/*************************************** * About:有向图的Dijkstra算法实现 * Author:Tanky Woo * Blog:t=0;if(flag == 0){printf(“Non”);}else{for(int i=min;i<=max;++i){if(mark[i]==1 && arr[i]==0)cnt++;}}if(cnt==1)printf(“Yesn”);elseprintf(“Non”);}} return 0;搜索算法模板BFS:1.#include2.#include3.#include4.#includeing namespace std;6.const int maxn=100;7.bool vst[maxn][maxn];// 访问标记8.int dir[4][2]={0,1,0,-1,1,0,-1,0};// 方向向量9.10.struct State // BFS 队列中的状态数据结构 11.{ 12.int x,y;// 坐标位置13.int Step_Counter;// 搜索步数统计器14.};15.16.State a[maxn];17.18.boolCheckState(State s)// 约束条件检验19.{ 20.if(!vst[s.x][s.y] &&...)// 满足条件 1: 21.return 1;22.else // 约束条件冲突 23.return 0;24.} 25.26.void bfs(State st)27.{ 28.queue q;// BFS 队列29.State now,next;// 定义 2 个状态,当前和下一个30.st.Step_Counter=0;// 计数器清零 31.q.push(st);// 入队32.vst[st.x][st.y]=1;// 访问标记33.while(!q.empty())34.{ 35.now=q.front();// 取队首元素进行扩展36.if(now==G)// 出现目标态,此时为Step_Counter 的最小值,可以退出即可37.{ 38.......// 做相关处理39.return;40.} 41.for(int i=0;i<4;i++)42.{ 43.next.x=now.x+dir[i][0];// 按照规则生成下一个状态44.next.y=now.y+dir[i][1];45.next.Step_Counter=now.Step_Coun ter+1;// 计数器加1 46.if(CheckState(next))// 如果状态满足约束条件则入队 47.{ 48.q.push(next);49.vst[next.x][next.y]=1;//访问标记 50.} 51.} 52.q.pop();// 队首元素出队53.} 54.return;55.} 56.57.int main()58.{ 59.......60.return 0;61.}代码:胜利大逃亡Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会.魔王住在一个城堡里,城堡是一个A*B*C的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个坐标中的其中一个.现在给你城堡的地图,请你计算出Ignatius能否在魔王回来前离开城堡(只要走到出口就算离开城堡,如果走到出口的时候魔王刚好回来也算逃亡成功),如果可以请输出需要多少分钟才能离开,如果不能则输出-1.Input 输入数据的第一行是一个正整数K,表明测试数据的数量.每组测试数据的第一行是四个正整数A,B,C和T(1<=A,B,C<=50,1<=T<=1000),它们分别代表城堡的大小和魔王回来的时间.然后是A块输入数据(先是第0块,然后是第1块,第2块......),每块输入数据有B行,每行有C个正整数,代表迷宫的布局,其中0代表路,1代表墙.(如果对输入描述不清楚,可以参考Sample Input中的迷宫描述,它表示的就是上图中的迷宫) 特别注意:本题的测试数据非常大,请使用scanf输入,我不能保证使用cin能不超时.在本OJ上请使用Visual C++提交.Output 对于每组测试数据,如果Ignatius能够在魔王回来前离开城堡,那么请输出他最少需要多少分钟,否则输出-1.Sample Input 1 3 3 4 20 0 1 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 0 0 1 0 1 1 1 0 0 0 0 0 1 1 0 0 1 1 0Sample Output 11代码:#include #include #include #include #includeusing namespace std;int tx[] = {0,1,-1,0,0,0,0};int ty[] = {0,0,0,1,-1,0,0};int tz[] = {0,0,0,0,0,1,-1};int arr[55][55][55];int known[55][55][55];// 访问标记int a,b,c,d;struct state{int x,y,z;// 所在的坐标int step_count;//统计搜索步数。

数学建模优秀论文(精选范文10篇)2021

数学建模优秀论文(精选范文10篇)2021

数学建模优秀论文(精选范文10篇)2021一、基于数学建模的空气质量预测研究本文以某城市为研究对象,通过数学建模方法对空气质量进行预测。

通过收集历史空气质量数据,构建空气质量预测模型。

运用机器学习算法对模型进行训练和优化,提高预测精度。

通过对预测结果的分析,为城市环境管理部门提供决策支持,有助于改善城市空气质量。

二、数学建模在物流优化中的应用本文针对某物流公司配送路线优化问题,运用数学建模方法进行求解。

建立物流配送模型,考虑配送成本、时间、距离等因素。

运用线性规划、遗传算法等优化算法对模型进行求解。

通过对求解结果的分析,为物流公司提供优化配送路线的建议,降低物流成本,提高配送效率。

三、基于数学建模的金融风险管理研究本文以某银行为研究对象,通过数学建模方法对金融风险进行管理。

构建金融风险预测模型,考虑市场风险、信用风险、操作风险等因素。

运用风险度量方法对模型进行评估。

通过对预测结果的分析,为银行提供风险控制策略,降低金融风险,提高银行稳健性。

四、数学建模在能源消耗优化中的应用本文针对某工厂能源消耗优化问题,运用数学建模方法进行求解。

建立能源消耗模型,考虑设备运行、生产计划等因素。

运用优化算法对模型进行求解。

通过对求解结果的分析,为工厂提供能源消耗优化策略,降低能源消耗,提高生产效益。

五、基于数学建模的交通流量预测研究本文以某城市交通流量为研究对象,通过数学建模方法进行预测。

收集历史交通流量数据,构建交通流量预测模型。

运用时间序列分析方法对模型进行训练和优化。

通过对预测结果的分析,为城市交通管理部门提供决策支持,有助于缓解城市交通拥堵。

数学建模优秀论文(精选范文10篇)2021六、数学建模在医疗资源优化配置中的应用本文以某地区医疗资源优化配置问题为研究对象,通过数学建模方法进行求解。

建立医疗资源需求模型,考虑人口分布、疾病类型等因素。

运用线性规划、遗传算法等优化算法对模型进行求解。

通过对求解结果的分析,为政府部门提供医疗资源优化配置策略,提高医疗服务质量。

美赛论文模板(中文版)

美赛论文模板(中文版)

For office use onlyT1________________ T2________________ T3________________ T4________________Team Control Number 26282Problem ChosenAFor office use onlyF1________________F2________________F3________________F4________________2014 Mathematical Contest in Modeling (MCM) Summary Sheet (Attach a copy of this page to your solution paper.)1.Introduction近年来,世界上的交通拥堵问题越来越严重,严重的交通拥堵问题引发了人们的对现行交通规则的思考。

在汽车驾驶规则是右侧的国家多车道高速公路经常遵循除非超车否则靠右行驶的交通规则,那么这个交通规则是否能够对交通拥堵起着什么作用呢?在汽车驾驶规则是右侧的国家多车道高速公路经常遵循以下原则:司机必须在最右侧驾驶,除非他们正在超车,超车时必须先移到左侧车道在超车后再返回。

根据这个规则,在美国单向的3车道高速公路上,最左侧的车道是超车道,这条车道的目的就是超车。

现在我们提出了4个问题:1、什么是低负荷和高负荷,如何界定他们?2、这条规则在提升车流量的方面是否有效?3、这条规则在安全问题上所起的作用?4、这条规则对速度的限制?1.1 Survey of Previous Research1.2 Restatement of the problem本题需要我们建立一个数学模型对这个规则进行评价。

我们需要解决的问题如下:●什么是低负荷和高负荷,如何界定他们?●这条规则在提升车流量的方面是否有效?●这条规则在安全问题上所起的作用?●这条规则对速度的限制?●对于靠左行的规则,该模型能否可以使用??(待定)●如果交通运输完全在智能系统的控制下,会怎样影响建立的模型?针对以上问题,我们的解题思路和方法如下所示:◆我们根据交通密度对低负荷和高负荷进行界定,交通密度是指:在某时刻,每单位道路长度内一条道路的车辆数。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

acm论文模板范文ACM是全世界领域影响力最大的专业学术组织。

而acm模板,你们知道吗?这是 ___为大家了两篇acm论文,这样你们对模板会有直观的印象![摘要] 鉴于ACM大学生程序设计竞赛(ACM/ICPC)在人才选拔和培养方面的显著作用,如何将ACM/ICPC竞赛活动嵌入常规教学,创新教学模式,结合专业教学,加强训练管理,提高培训效益,已成为人们关注的问题。

针对这一应用需求,本文设计并开发了基于ACM/ICPC机制的大学生程序设计培训管理系统。

系统采用B/S架构,以SQL Server xx作为后台管理数据库,Visual Studio 和为前端开发工具。

在分析系统功能的基础上,着重阐述了该系统设计与实现的关键技术。

该系统实际运行稳定、可靠,为开展ACM/ICPC竞赛培训和教学提供了一种有效管理途径。

[关键词] ACM/ICPC;培训管理系统;Web开发;;数据库技术doi : 10 . 3969 / j . issn . 1673 - 0194 . xx . 03. 015[] TP311 [] A [] 1673 - 0194(xx)03- 0028- 031 引言ACM国际大学生程序设计竞赛(ACM International Collegiate Programming Contest, ACM ICPC) 由美国计算机协会(ACM)主办,始于1970年,至今已经有40多年的,是世界公认的规模最大、水平最高、影响广泛的国际大学生程序设计竞赛,竞赛优胜者是各大IT企业和科研院所青睐和优先选拔的人才[1]。

近些年来,伴随着ACM/ICPC大学生程序设计竞赛在国内如火如荼地开展,计算机界更加关注在人才培养方面,如何科学合理地引入、借鉴ACM/ICPC竞赛训练,将ACM/ICPC竞赛活动与常规专业课程教学有机结合起来,突破传统教学内容和,以有效培养学生的学习能力、创新意识和综合素质。

这其中,如何有效组织开展ACM/ICPC竞赛训练,加强培训管理,提高培训效益,亦是人们关注的热点问题。

但就目前情况来看,组织开展此项竞赛活动的训练指导或教学培训还没有一个成熟通用的、基于ACM/ICPC竞赛机制的ACM/ICPC 训练和活动的教学管理平台。

具体表现在:(1)尽管一些知名院校搭建了自己的在线测试平台[2-3],但由于大多采用英文表述问题,对于水平不高的低年级本科生和专科学生来说,在翻译题目和理解内容方面会出现偏差,导致在这些平台上进行在线模拟测验的效果并不理想;(2)很多网站虽然提供了ACM/ICPC竞赛的相关资料,比如网上题库、相关赛题的题解等,但这些资料在网上分布得比较分散,使得学生很难集中查阅,而且由于资料的层次性和难易性区分不明显,使得学生在查阅和资料时遇到很多困难;(3)关于ACM/ICPC的网上论坛不少,但大多内容仅介绍ACM/ICPC的发展、竞赛取得的成绩和,学生很难在程序的求解方法和求解过程方面进行适时的互动;(4)虽然上述网上交流方式和测试学习方式符合现代化教育的理念,但是从系统管理的角度看,这些功能模块比较分散,难以真正适应目前ACM/ICPC竞赛培训管理的需要。

基于上述应用需求,结合集宁师范学院多年参加这一赛事、组织开展ACM/ICPC竞赛训练活动的管理实践经验,我们开发了一个本专科通用的ACM/ACPC培训管理系统,该系统是一个基于B/S结构的多用户在线系统,实现了资源共享、在线讨论、测试、网络化管理等功能。

2 系统分析2.1 系统功能结构ACM/ICPC培训管理系统是一个B/S结构的Web应用系统。

ACM/ICPC培训管理系统的主要功能是完成网络学习的综合浏览、学习资源的上传和下载、在线讨论、在线测试和系统管理等功能,系统功能结构如图1所示。

2.2 功能模块需求分析用户登录模块为用户提供安全的访问和数据操作,防止非法用户进入系统。

本系统的登录模块分为系统管理员和登录用户。

系统管理员可以完成登录用户的管理和系统后台数据库管理的功能;登录用户可以参与网上资源共享、在线讨论和在线测试等多方面的操作。

资源在线模块包括浏览资源、查找资源和下载资源3个部分,用来完成网上资源的查找、阅览和下载。

登录用户能够将服务器中的资源下载到本地查看或进一步学习,也可以上传自己的资源。

在线论坛模块使得用户不但可以发表,而且可以浏览到其他用户在论坛发表的各种意见、问题等。

本模块主要包括浏览帖子、发表帖子和回复帖子3个子模块。

为了能够更好地管理好论坛,本模块主要提供了3种角色:匿名用户(没有注册的用户)、已经注册的用户和管理员。

当匿名用户进入论坛之后,只能对网站的页面进行简单浏览;而已经注册的用户进入论坛之后,可以发表自己的评论和回复帖子。

在线测试模块包括在线选题、在线提交、系统测试的功能[2],该模块提供了一个符合ACM/ICPC竞赛需求的学习训练平台。

用户可以按照问题的说明编写源代码,并通过在线提交子模块上传给系统。

系统根据用户提供的语言和源代码生成对应语言扩展名的源程序文件,调出相应的编译器来运行源程序并进行测试。

通过编译、执行后,系统将运行时捕捉的输出信息同预先存放的标准测试输出文件进行比较,返回测试结果(比较一致,则返回运行信息,否则返回运行错误信息),并将运行成功后的有关信息(程序源代码、用户数据表的通过数量、问题类别表的通过数量、计算机耗时等)存入数据库。

系统管理模块为负责组织开展ACM/ICPC训练活动的主管教师提供一个对培训平台信息集中管理的手段。

主管教师以系统管理员身份登录后,通过对数据库信息的修改来实现对系统各个模块数据信息的管理和完善,通过直接操作数据库的方式,完成对数据库存放各个模块的数据信息增加、删除和修改的功能。

3 系统设计ACM/ICPC培训管理系统作为一个网络化培训平台,系统采用Browser/Server(浏览器/服务器)结构,由客户端、服务器和数据库服务器三部分组成[4],如图2所示。

B/S模式是一种平面型多层次的网状结构,其最大的特点就是与软硬件的无关性,应用逻辑和业务处理规则在服务器端实现,客户端可以做得尽可能简单,可以只是一个多媒体浏览器。

在具体实现时,使用SQL Server xx数据库管理系统建立和管理网站数据库;运用动态网页技术()开发系统,使用HTML、C#等语言编写应用程序;使用Visual Studio xx平台进行系统开发。

3.1 Web应用系统的开发技术是 Framework中一套用于生成Web应用程序和XML Web Services的技术,可以创建动态的Web页面。

本系统选择了Visual Studio xx作为开发程序的工具,网页开发的脚本语言选用了C#语言。

Visual Studio xx 提供了各种增强功能[5],例如可视化设计器(使用 .Net Framework 加速开发),对Web 开发工具的大量改进,以及能够加速开发和处理所有类型数据的语言增强功能,并为开发人员提供了所有相关的工具和框架支持。

C#是微软公司随.Net一起发布的新的语言。

C#是C/C++语言家族中第一种面向组件的编程语言。

它由C和C++派生而来,是一种使用简单、面向对象、类型安全的现代编程语言。

C# 不仅具有Viusal Basic的高效性,而且具有C++的强大性,它是专门为.Net 设计的一种语言,在.Net中起着不可替代的作用。

3.2 数据库技术本文采用SQL Server xx作为数据库管理系统,并采用 技术进行数据库的操作和访问。

是.Net Framework用于访问数据的组件,它的一个重要优点就是可以以离线方式操作数据库,减少应用程序对服务器资源的占用,提高应用程序的效率。

.Net Framework提供了4个.Net Framework数据提供程序,其中SQL Server .Net Framework数据提供程序就是用于实现对SQL Server 的连接访问[6]。

SQL Server .Net Framework的框架如图3所示。

针对ACM/ICPC培训管理系统的数据管理需求分析,本系统设计了用户信息表、资源分类数据表、资源数据表、论坛模块信息表、论坛帖子信息表、回复帖子信息表、问题类别信息表、问题表列信息表和运行状态信息表9个数据库表。

4 关键技术的实现4.1 资源上传功能的实现在上传资源页面管理中,系统先判断文件大小和文件名是否存在,如果文件大足要求且文件名不存在,为了节省存储空间,先将该文件内容转成二进制流,并和其他信息一起插入到资源数据表中。

获取上传文件、测试文件大小和将文件转换成二进制流的关键代码如下:string FileName = myFile.Value;//获取上传的文件名HttpPostedFile UpFile = myFile.PostedFile;//获取对由客户端指定的上传文件的访问FileLength = UpFile.ContentLength;//获取上传文件的字节大小if (FileLength == 0){ Response.Write("");}{ Response.Write("");}else{FileName = FileName.Substring(stIndexOf("\\") +1);//文件名。

Byte[] FileByte = new Byte[FileLength];//将指定文件储存到数组Stream ObjectStream = UpFile.InputStream;//建立数据流对象,该对象指向一个上载文件,读取该文件的内容ObjectStream.Read(FileByte, 0, FileLength);//读取指定文件数据}4.2 测试系统的实现在线测试模块的系统测试功能是本系统的设计关键,利用读取用户输入的源代码,并把源代码生成源代码文件。

利用服务器上提供的程序编译器对源代码进行编译、链接和运行,把运行结果与数据库的标准答案进行对比并给出结果。

下面以C++程序为例来介绍系统测试功能的实现方法。

主要包括以下3步:(1)系统通过web.config文件的配置信息获取测试需要的路径配置信息,路径E:/Compiler/用于存放测试运行中需要处理的文件,路径E:/Compiler/Compiler/用于存放测试需要的编译器。

web.config文件的配置信息如下://编译其处理文件的文件夹//存放编译器的文件夹(2)系统将用户提交的源代码以文件形式存放在系统配置的路径下,源代码文件名根据系统提交源代码的时间生成,关键代码如下:string sign=DateTime.Now.ToString().Replace("/","_").Replace(":","");//将时间格式转换成字符串格式,例如xx_5_xx4803。

相关文档
最新文档