ACM试题.docx_第1页
ACM试题.docx_第2页
ACM试题.docx_第3页
ACM试题.docx_第4页
ACM试题.docx_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1000: A + B ProblemTime Limit: 1 SecMemory Limit: 32 MBSubmit: 52Solved: 25SubmitSTATUSWeb BoardDescription计算A+B的值 Input每行包含两个32位之内的整型数据,输入以EOF结束Output对于每组输入的两个数,输出它们的和。每组数据单独一行。Sample Input1 111 11 Sample Output222HINT注意:每计算一次和,直接输出就可以了。不用把每次的和保存下来再一起输出。Source1002: Cleaning the DishesTime Limit: 1 SecMemory Limit: 16 MBSubmit: 2Solved: 0SubmitSTATUSWeb BoardDescriptionBessie and Canmuu are teaming up to wash the massive pile of N (1= N = 10,000) dirty dishes left over after the CowMoose Festival.Bessie is washing the dishes; Canmuu will dry them.Each dish has a unique serial number in the range 1.N. At thebeginning, the dishes are stacked in order with #1 on the top and#N on the bottom.Bessie first washes some number of dishes D_i by taking one fromthe top of the incoming pile, washing it, and then stacking it onthe other side of the sink (this reverses the order of those dishes).Once she has finished washing those dishes, either she washes anotherset of dishes or Canmuu comes back to dry D_i dishes while Bessiegoes off to eat her well-earned snack. He takes those dishes, oneby one, off the stack that Bessie left him, dries the dish, andstacks it (again in reverse order) in the cleaned stack.Canmuu then either takes another set of dishes to dry or goes offto get a snack while Bessie comes back to wash. They repeat theseoperations until all of the dishes are washed and dried.What is the final order (top to bottom) in which the clean, drydishes are stacked?To illustrate, suppose that Bessie has a stack of 5 dishes to wash:1 - top2345 3 - 3 - 3 4 4 4 2 4 2 BOTTOM 5 - - 5 1 - 5 1 - 5 1 - Initial Dish 1 Dish 2 Dish 3Canmuu dries two of these, one by one, and places them onto the clean stack:TOP 3 4 2 - 4 2 - 4 2BOTTOM 5 1 - 5 1 3 5 1 3Bessie washes the final two dishes:TOP 5 4 2 - 4 2 - 4 2BOTTOM 5 1 3 5 1 3 - 1 3Finally, Canmuu dries the last three dishes, stacking them in theresulting order below:TOP 1 4 4 5 - 5 - 5 - 5 4 2 4 2 2 2BOTTOM - 1 3 - 1 3 - 1 3 - - 3So the final order is: 1, 4, 5, 2, 3.Each of the main input lines contains both a command, C_i (1 = C_i= 2) where 1 indicates Bessie washing while 2 indicates Canmuudrying, and the number of dishes D_i (1 = D_i = N) to be washedor dried.Input* Line 1: A single integer indicating the number of dishes to wash and dry: N* Lines 2.?: Each line contains a command and a count of dishes to process: C_i and D_iOutput* Lines 1.N: Line i contains the i-th cleaned dish, starting from the topSample Input51 32 21 22 3Sample Output14523HINTSource1017: 有几个交点?Time Limit: 1 SecMemory Limit: 32 MBSubmit: 5Solved: 2SubmitSTATUSWeb BoardDescription给你N(1=N=100)条线段,你能判断它们一共有多少交点吗?假设任意三条线段不交于同一点。输入包含多组数据,每组测试数据包含一个整型数据N(1=N=100)。下面紧跟N行数据,每行数据包括一条线段的坐标x1,y1,x2,y2,测试数据以0结束。对于每组测试数据,输出交点个数,每个输出占一行。InputOutputSample Input20.00 0.00 1.00 1.000.00 1.00 1.00 0.0030.00 0.00 1.00 1.000.00 1.00 1.00 0.0000.00 0.00 1.00 0.000Sample Output13HINTSource1009: 第几天?Time Limit: 1 SecMemory Limit: 16 MBSubmit: 20Solved: 9SubmitSTATUSWeb BoardDescription给定一个日期,输出这个日期是该年的第几天。 Input输入数据有多组,每组占一行,数据格式为YYYY/MM/DD组成,具体参见sample input ,另外,可以向你确保所有的输入数据是合法的。 Output对于每组输入数据,输出一行,表示该日期是该年的第几天。 Sample Input1985/1/202006/3/12Sample Output2071HINTSource1014: 计算GPATime Limit: 1 SecMemory Limit: 32 MBSubmit: 90Solved: 12SubmitSTATUSWeb BoardDescription每学期的期末,大家都会忙于计算自己的平均成绩,这个成绩对于评奖学金是直接有关的。国外大学都是计算GPA(grade point average) 又称GPR(grade point ratio),即成绩点数与学分的加权平均值来代表一个学生的成绩的。那么如何来计算GPA呢?一般大学采用之计分法A90 - 100 4 点B80 - 89 3 点C70 - 79 2 点D60 - 69 1 点E0 - 59 0 点例如:某位学生修习三门课,其课目、学分及成绩分别为:英文:三学分、92 分;化学:五学分、80 分;数学:二学分、60分,则GPA的算法如下:科目学分分数点数分数点数英文392412化学580315数学26012合计102929/10=2.92.9即为某生的GPA下面有请你写一个用于计算GPA的程序。 Input包含多组数据,每组数据的第一行有一

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论