NOIP2009高中复赛试题
金华一中信息学奥林匹克联赛(NOIP2009)复赛模拟试题(汇总
金华一中信息学奥林匹克联赛(NOIP2009)复赛模拟试题(三)一、题目概览中文题目名称遥控车车展拉力赛舞台设置英文题目名称car exhibit rally stage 可执行文件名car exhibit rally stage 输入文件名car.in exhibit.in rally.in stage.in 输出文件名car.out exhibit.out rally.out stage.out1秒1秒1秒1秒每个测试点时限测试点数目10 10 10 1010 10 10 10每个测试点分值比较方式全文比较全文比较全文比较全文比较二、运行内存限制运行内存上限512 M512 M512 M512 M第一题:遥控车【题目描述】平平带着韵韵来到了游乐园,看到了n辆漂亮的遥控车,每辆车上都有一个唯一的名字name[i]。
韵韵早就迫不及待地想玩名字是s的遥控车。
可是韵韵毕竟还小,她想象的名字可能是一辆车名字的前缀(也就是说能确定一个i,使s是name[i]的前缀),这时她就能玩第i辆车;或者是一个无中生有的名字,即s不是任何一辆车名字的前缀,这时候她什么也不能玩。
你需要完成下面的任务:1.韵韵想了m个她想要的名字,请告诉她能玩多少次。
2.由于管理员粗心的操作,导致每辆车的摆放位置都可能出现微小的差错,原来第i辆车现在的位置可能是i-1、i、i+1中的任意一个(第1辆车的位置不可能是0,第n辆车的位置不可能是n+1)。
请你计算出共有多少种可能的排列。
注:数据保证当s是name[i]的前缀时,i是唯一确定的。
一辆车可以玩多次。
【输入格式】第一行是2个正整数n、m。
接下来n行,每行1个字符串name[i],表示第i辆车的名字。
接下来m行,每行1个字符串s,表示韵韵想要的名字。
【输出格式】第一行输出韵韵能玩的次数。
第二行输出共有多少种可能的排列。
【输入样例】4 4AbcdDeFAAaaBcccAbAAAbCaBcc【输出样例】35对于题目涉及到的字符串严格区分大小写,且长度小于255。
2009年第26届全国中学生高中物理竞赛复赛试题(Word版,含答案)
第26届全国中学生物理竞赛复赛试卷一、填空(问答)题(每题5分,共25分)1.有人设想了一种静电场:电场的方向都垂直于纸面并指向纸里,电场强度的大小自左向右逐渐增大,如图所示。
这种分布的静电场是否可能存在?试述理由。
2.海尔-波普彗星轨道是长轴非常大的椭圆,近日点到太阳中心的距离为0.914天文单位(1天文单位等于地日间的平均距离),则其近日点速率的上限与地球公转(轨道可视为圆周)速率之比约为(保留2位有效数字) 。
3.用测电笔接触市电相线,即使赤脚站在地上也不会触电,原因是 ;另一方面,即使穿绝缘性能良好的电工鞋操作,测电笔仍会发亮,原因是。
4.在图示的复杂络中,所有电源的电动势均为E 0,所有电阻器的电阻值均为R 0,所有电容器的电容均为C 0,则图示电容器A 极板上的电荷量为 。
5.如图,给静止在水平粗糙地面上的木块一初速度,使之开始运动。
一学生利用角动量定理来考察此木块以后的运动过程:“把参考点设于如图所示的地面上一点O ,此时摩擦力f 的力矩为0,从而地面木块的角动量将守恒,这样木块将不减速而作匀速运动。
”请指出上述推理的错误,并给出正确的解释:。
二、(20分)图示正方形轻质刚性水平桌面由四条完全相同的轻质细桌腿1、2、3、4支撑于桌角A 、B、C 、D 处,桌腿竖直立在水平粗糙刚性地面上。
已知桌腿受力后将产生弹性微小形变。
现于桌面中心点O 至角A 的连线OA 上某点P 施加一竖直向下的力F ,令c OAOP=,求桌面对桌腿1的压力F 1。
三、(15分)1.一质量为m 的小球与一劲度系数为k 的弹簧相连组成一体系,置于光滑水平桌面上,弹簧的另一端与固定墙面相连,小球做一维自由振动。
试问在一沿此弹簧长度方向以速度u 作匀速运动的参考系里观察,此体系的机械能是否守恒,并说明理由。
2.若不考虑太阳和其他星体的作用,则地球-月球系统可看成孤立系统。
若把地球和月球都看作是质量均匀分布的球体,它们的质量分别为M 和m ,月心-地心间的距离为R ,万有引力恒量为G 。
Noip2009复赛普及组
Noip2009复赛普及组1.多项式输出(poly.pas/c/cpp)【问题描述】给出一个一元多项式各项的次数和系数,请按照如下规定的格式要求输出该多项式:1. 多项式中自变量为x,从左到右按照次数递减顺序给出多项式。
2. 多项式中只包含系数不为0 的项。
3. 如果多项式n 次项系数为正,则多项式开头不出现“+”号,如果多项式n 次项系数为负,则多项式以“-”号开头。
4. 对于不是最高次的项,以“+”号或者“-”号连接此项与前一项,分别表示此项系数为正或者系数为负。
紧跟一个正整数,表示此项系数的绝对值(如果一个高于0 次的项,其系数的绝对值为1,则无需输出1)。
如果x 的指数大于1,则接下来紧跟的指数部分的形式为“x^b”,其中b 为x 的指数;如果x 的指数为1,则接下来紧跟的指数部分形式为“x”;如果x 的指数为0,则仅需输出系数即可。
5. 多项式中,多项式的开头、结尾不含多余的空格。
【输入】输入文件名为poly.in,共有2 行第一行1 个整数,n,表示一元多项式的次数。
第二行有n+1 个整数,其中第i 个整数表示第n-i+1 次项的系数,每两个整数之间用空格隔开。
【输出】输出文件poly.out 共1 行,按题目所述格式输出多项式。
【输入输出样例1】poly.in5100 -1 1 -3 0 10poly.out100x^5-x^4+x^3-3x^2+10【输入输出样例2】poly.in3-50 0 0 1poly.out-50x^3+1【数据范围】1 ≤n ≤100,多项式各次项系数的绝对值均不超过100。
(score.pas/c/cpp)【问题描述】世博会志愿者的选拔工作正在A 市如火如荼的进行。
为了选拔最合适的人才,A 市对所有报名的选手进行了笔试,笔试分数达到面试分数线的选手方可进入面试。
面试分数线根据计划录取人数的150%划定,即如果计划录取m名志愿者,则面试分数线为排名第m*150% (向下取整)名的选手的分数,而最终进入面试的选手为笔试成绩不低于面试分数线的所有选手。
ioi2009
21-st International Olympiad In Informatics TASKS AND SOLUTIONSAugust8-15,2009Plovdiv,Bulgaria221-st International Olympiad In Informatics Day0Task0.1AREAA large agricultural corporation is undertaking an audit of its N land proper-ties.As afirst step,they would like to know the total area of their properties. Each property has a rectangular shape,and no two properties overlap.You realize that this is a trivial calculation,but you understand that you need to solve this problem in order to test your ability to properly handle large amounts of data and large numbers under the IOI2009contest system.TASKWrite a program that,given the dimensions of the N land properties,deter-mines the sum of their areas.CONSTRAINTS1≤N≤500000–The number of land properties1≤A k,B k≤20000–The lengths of the sides of property kINPUTYour program should read from the standard input the following data:•Thefirst line contains a single integer:the number of properties N.•The next N lines describe the properties,one property per line.The k th of these lines describes property number k and it contains two integers separated by a single space:the lengths of the sides of the property A k and B k measured in meters.OUTPUTYour program should write to the standard output a single line containing a single integer:the total area of all properties,measured in square meters.IMPORTANT NOTEThefinal answer may notfit in32bits.You have to use a64-bit data type, such as long long in C/C++or int64in Pascal,in order to compute and store the answer in a single variable.Please see the technical info sheet for details.2009August8-15,Plovdiv,Bulgaria3 EXAMPLESample Input Sample Output408315255631Task0.2HILL(proposed by Iskren Chernev)An extraterrestrial team of contestants,known as the aliens,is coming to Plov-div for the IOI.They would like to land theirflying saucer on one of Plovdivs hills, but they have no map of the city,so they need to use their laser scanner tofind a hill.The aliens have divided the city into a grid of N by M cells,and each time they use the scanner they can determine the altitude of a single cell.Their scanner is so precise that no two cells would ever have the same altitude.The aliens define a hill as a cell that has higher altitude than all of its adjacent cells.Two cells are considered adjacent if they share a side.Thus typically each cell has four adjacent ones,with the cells on the border of the grid being the exception(they have less than four adjacent cells).The aliens have time for only3050scans before their saucer hits the ground. Help the aliensfind a hill before they run out of time.TASKWrite a program that,given the dimensions of the grid,interactively uses the scanner to determine the location of a hill,while doing no more than3050scans in total.CONSTRAINTS1≤N,M≤1000–The dimensions of the grid1≤A x,y≤2000000000–The altitude of cell<x,y>INPUTYour program should read from the standard input a single line with two integers N and M,separated by a single space.421-st International Olympiad In InformaticsINTERACTIONAfter reading the input data,your program should start using the laser scanner. Each time you want to use the scanner for a cell with coordinates x and y(1≤x≤N,1≤y≤M),you should print a single line on the standard output,containing three integers separated by single spaces:0(a literal zero),x and y,in this order.After submitting your request to the scanner,you should read a single line on the standard input.It will contain a single integer:the altitude of the cell with coordinates x and y in some alien units.OUTPUTWhen your program has determined the location of a hill<a,b>(1≤a≤N, 1≤b≤M),you should report your answer by printing a single line on the standard output,containing three integers separated by single spaces:1(a literal one),a and b,in this order.IMPORTANT NOTE:In order to interact properly with the scanner,your program needs toflush the standard output after every line that you print on the standard output.Please see the technical info sheet for instructions on how to do this properly.EXAMPLESample Input Sample Output323 4 1 7 6011[flush stdout/output] 021[flush stdout/output] 031[flush stdout/output] 012[flush stdout/output] 022[flush stdout/output] 112[flush stdout/output]2009August8-15,Plovdiv,Bulgaria50.3MUSEUM(proposed by Boyko Bantchev)The Plovdiv Museum of Modern Art has an exhibition of ancient Thracian vases.There are N vases total.Thefirst one is a miniature of height1centimeter. The second one is of height2centimeters;the third one is3centimeters tall and so on until the N th vase,which is N centimeters tall.Since this a modern art museum and the vases are ancient,the organizers of the exhibition would like to add a modern,chaotic twist to the presentation of the vases.They have decided to arrange the vases in a line that satisfies the following condition:For any three vases A,B and C,such that B s height is exactly the average of the heights of A and C,either B must be positioned to the left of bothA and C,orB must be positioned to the right of both A and C(in other words,B may not be positioned between A andC on the line).TASKWrite a program that,given the number of vases,determines a linear arrange-ment of the vases that satisfies the condition of the exhibition organizers.CONSTRAINTS1≤N≤2000–The number of vasesINPUTYou are givenfive problem instances in thefiles museum.1.in to museum.5.in. Eachfile contains a single line,which in turn contains a single integer:the number of vases N.OUTPUTYou are to submitfive outputfiles,named museum.1.out to museum.5.out, each corresponding to one of the inputfiles.Thefiles should be in the following format:There should be N lines,each representing the N positions in the arrangement, in order from left to right.Line k should contain a single integer H k,the height of the vase you decided to place on position k.All N heights should be distinct integers between1and N inclusive.621-st International Olympiad In InformaticsEXAMPLESample Input Sample Outputmuseum.0.in museum.0.out531254In the above arrangement,3is neither between2and4,nor is it between1 and5.Also,2is not between1and3,and4is not between3and5.Thus,it satisfies the condition of the exhibition organizers.TECHNICAL INFO SHEET(day0)These pages contain helpful information on how to avoid slow input/output performance with C++streams(cin/cout),how to use64-bit data types(vari-ables)and how toflush the output for interactive tasks.Slow Input/Output with C++StreamsWhen solving tasks with very large amounts of input/output data,you may notice that C++programs using the cin and cout streams are much slower than equivalent programs that use the scanf and printf functions for input and output processing.Thus,if you are using the cin/cout streams we strongly recommend that you switch to using scanf/printf instead.However,if you still want to use cin /cout,we recommend adding the following line at the beginning of your program: ios::sync_with_stdio(false);and also making sure that you never use endl,but use\n instead.Please note,however,that including ios::sync_with_stdio(false)breaks the synchrony between cin/cout and scanf/printf,so if you are using this,you should never mix usage of cin and scanf,nor mix cout and printf.64-bit Data TypesFor some tasks you may need to deal with numbers too large tofit in32bits. In these cases,you would have to use a64-bit integer data type,such as long long2009August8-15,Plovdiv,Bulgaria7 in C/C++or int64in Pascal.Here is some sample code that illustrates the usage of these data types:C/C++int main(void){long long varname;scanf("%lld",&varname);//Do something with the varname variableprintf("%lld\n",varname);return0;}Pascalvarvarname:Int64;beginread(varname);{Do something with the varname variable}writeln(varname);end.Flushing the OutputWhenever you solve an interactive task,you always need toflush the buffer of your output after every new line printed on the output.Here is some code to illustrate how to do this under C,C++and Pascal:C or C++with scanf/printffflush(stdout);C++with cin/coutcout<<flush;Pascalflush(output);821-st International Olympiad In Informatics Task Overview Sheet(Day0)Area Hill Museum Type Batch Interactive Output-onlyDetailed Feedback Full Partial NoneTime Limit(per test case)2seconds1second Not ApplicableMemory Limit(per test case)32MB64MB Not ApplicablePoints100100100NOTE:On the actual competition there will be four problems on each day.We have only three problems here because the practice contest is shorter in duration and because there are only three possible task types.2009August8-15,Plovdiv,Bulgaria9 Day11.1ARCHERY(proposed by Velin Tzanov)An archery tournament is held according to the following rules.There are N targets arranged in a line and numbered from1to N inclusive according to their place on the line(the leftmost target being target1,and the rightmost target being target N).There are also2∗N archers.At any time during the tournament,there are two archers on each target.Every round of the tournament goes according to the following procedure:The two archers on each target compete with each other and determine a winner and a loser between them.Then all archers are rearranged as follows: The winners on targets2to N inclusive move to the target on their left(i.e., targets1to N−1respectively).The losers on targets2to N inclusive,as well as the winner on target1,remain on the same target.The loser on target1moves to target N.The tournament continues for R rounds,with the number of rounds being at least as many as the number of archers(i.e.,R≥2∗N).You are the only archer to arrive for the tournament exactly on time.All other 2∗N−1archers have arrived early and are already standing in a line.What you have to do now is to insert yourself somewhere into the line amongst them.You know that after you take your position,the two leftmost archers in the line will start the tournament on target1,the next two will start on target2and so on, with the two rightmost archers starting on target N.All the2∗N archers in the tournament(including yourself)are ranked by skill,where a smaller rank corresponds to better skill.No two archers have the same rank.Also,whenever two archers compete,the one with the smaller rank will always win.Knowing how skilled each of your competitors is,you want to insert yourself in such a way as to ensure that you willfinish the tournament on a target with as small a number as possible.If there are multiple ways to do this,you prefer the one that starts at a target with as large a number as possible.TASKWrite a program that,given the ranks of all archers,including yourself,as well as your competitors arrangement on the line,determines on which target you1021-st International Olympiad In Informaticsshould start the tournament,so that you can achieve your goals as defined above.CONSTRAINTS1≤N≤200000–The number of targets;also equal to half the number of archers2∗N≤R≤1000000000–The number of tournament rounds1≤S k≤2∗N–The rank of archer kINPUTYour program must read from standard input the following data:Thefirst line contains the integers N and R,separated by a space.The next2∗N lines list the ranks of the archers.Thefirst of these lines contains your rank.The rest of these lines contain the ranks of the other archers, one archer per line,in the order in which they have arranged themselves(from left to right).Each of these2∗N lines contains a single integer between1and2∗N inclusive.A rank of1is the best and a rank of2∗N is the worst.No two archers have the same rank.OUTPUTYour program must write to standard output a single line containing a single integer between1and N inclusive:the number of the target on which you will start the tournament.GRADINGFor a number of tests,worth a total of60points,N will not exceed5000. Also,for some of these tests,worth a total of20points,N will not exceed200.EXAMPLESSample Input Smaple Output348742658132009August8-15,Plovdiv,Bulgaria11 You are the second worst archer.If you start on target1,you will then go to target4and stay there until the end.If you start on target2or4,you will just stay there for the whole tournament.If you start on target3,you will beat the worst archer and then move to target2and stay there.Sample Input Smaple Output24921583476You are the second best archer.The best one is already on target1and will stay there for the whole duration of the tournament.Thus,no matter where you start,you will always move from your target,going through all targets from4to 1over and over again.In order for you to end on target1after9transitions,you have to start on target2.1.2HIRING(proposed by Velin Tzanov)You have to hire workers for a construction project.There are N candidates applying for the job,numbered from1to N inclusive.Each candidate k requires that if he is hired,he must be paid at least S k dollars.Also,each candidate k has a qualification level Q k.The regulations of the construction industry require that you pay your workers in proportion to their qualification level,relative to each other.For example,if you hire two workers A and B,and Q A=3∗Q B,then you have to pay worker A exactly three times as much as you pay worker B.You are allowed to pay your workers non-integer amounts of money.This even includes quantities that cannot be written with afinite number of digits in decimal form, such as a third or a sixth of a dollar.You have W dollars at hand and you want to hire as many workers as possible. You decide whom to hire and how much to pay them,but you have to meet the minimum salary requirements of those you choose to hire,and you have to obey the industry regulations.You also have tofit within your budget of W dollars.1221-st International Olympiad In Informatics The nature of your project is such that the qualification level is completely irrelevant,so you are only interested in maximizing the number of workers without regard to their qualification level.However,if there is more than one way to achieve this,then you want to select the one where the total amount of money you have to pay your workers is as small as possible.In case there is more than one way to achieve this,then you are indifferent among these ways and you would be satisfied with any one of them.TASKWrite a program that,given the different salary requirements and qualification levels of the candidates,as well as the amount of money you have,determines which candidates you should hire.You must hire as many of them as possible and you must do so with as little money as possible,while complying with the industry regulations specified above.CONSTRAINTS1≤N≤500000–The number of candidates1≤S k≤20000–The minimum salary requirement of candidate k1≤Q k≤20000–The qualification level of candidate k1≤W≤10000000000–The amount of money available to youIMPORTANT NOTEThe maximum value of W does notfit in32bits.You have to use a64-bit data type,such as long long in C/C++or int64in Pascal,in order to store the value of W in a single variable.Please see the technical info sheet for details.INPUTYour program must read from standard input the following data:•Thefirst line contains the integers N and W,separated by a space.•The next N lines describe the candidates,one candidate per line.The k th of these lines describes candidate number k and it contains the integers S k and Q k, separated by a space.OUTPUTYour program must write to standard output the following data:•Thefirst line must contain a single integer H,the number of workers that you hire.•The next H lines must list the identifying numbers of the candidates you choose to hire(each of them a different number between1and N),one per line, in any order.2009August8-15,Plovdiv,Bulgaria13GRADINGFor any given test case,you will receive full points if your choice of candidates enables you to achieve all of your goals,while satisfying all constraints.If you produce an outputfile with a correctfirst line(i.e.,a correct value of H),but which does not meet the above description,you will receive50%of the points for that test case.The latter will be the case even if the outputfile is not properly formatted,as long as thefirst line is correct.For a number of tests,worth a total of50points,N will not exceed5000.EXAMPLESSample Input Sample Output4100 51000 10100 810 2012 2 3The only combination for which you can afford to hire two workers and still meet all the constraints is if you select workers2and3.You can pay them80and 8dollars respectively and thusfit in your budget of100.Sample Input Sample Output34 12 13 133 1 2 3Here you can afford to hire all three workers.You pay1dollar to worker1and 1.50dollars each to workers2and3,and you manage to hire everyone with the4 dollars that you have.Sample Input Sample Output340 101 102 1032 2 3Here you cannot afford to hire all three workers,as it would cost you60dollars, but you can afford to hire any two of them.You choose to hire workers2and31421-st International Olympiad In Informatics because they would cost you the smallest sum of money,compared to the other two-worker combinations.You can pay10dollars to worker2and15dollars to worker3for a total of25dollars.If you were to hire workers1and2you would have to pay them at least10and20dollars respectively.If you were to hire1and 3,then you would have to pay them at least10and30dollars respectively.Task1.3POI(proposed by Carl Hultquist)The local Plovdiv Olympiad in Informatics(POI)was held according to the following unusual rules.There were N contestants and T tasks.Each task was graded with only one test case,therefore for every task and every contestant there were only two possibilities:either the contestant solved the task,or the contestant did not solve the task.There was no partial scoring on any task.The number of points assigned to each task was determined after the contest and was equal to the number of contestants that did not solve the task.The score of each contestant was equal to the sum of points assigned to the tasks solved by that contestant.Philip participated in the contest,but he is confused by the complicated scoring rules,and now he is staring at the results,unable to determine his place in the final standings.Help Philip by writing a program that calculates his score and his ranking.Before the contest,the contestants were assigned unique IDs from1to N inclu-sive.Philips ID was P.Thefinal standings of the competition list the contestants in descending order of their scores.In case of a tie,among the tied contestants, those who have solved more tasks will be listed ahead of those who have solved fewer tasks.In case of a tie by this criterion as well,the contestants with equal results will be listed in ascending order of their IDs.TASKWrite a program that,given which problems were solved by which contestant, determines Philips score and his rank in thefinal standings.CONSTRAINTS1≤N≤2000–The number of contestants1≤T≤2000–The number of tasks1≤P≤N–Philips ID2009August8-15,Plovdiv,Bulgaria15INPUTYour program must read from standard input the following data:•Thefirst line contains the integers N,T and P,separated by individual spaces.•The next N lines describe which tasks were solved by which contestant.The k th of these lines describes which tasks were solved by the contestant with ID k.Each such line contains T integers,separated by spaces.Thefirst of these numbers denotes whether or not contestant k solved thefirst task.The second number denotes the same for the second task and so on.These T numbers are all either0or1,where1means that contestant k solved the corresponding task,and 0means that he or she did not solve it.OUTPUTYour program must write to standard output a single line with two integers separated by a single space.First,the score that Philip got on the POI competi-tion.Second,Philips rank in thefinal standings.The rank is an integer between1 and N inclusive,with1denoting the contestant listed at the top(i.e.,a contestant who has the highest score)and N to the one listed at the bottom(i.e.,a contestant with the lowest score).GRADINGFor a number of tests,worth a total of35points,no other contestant will have the same score as Philip.EXAMPLESample Input Sample Output32532001110100110110Thefirst problem was unsolved by only one contestant,so it is worth1point. The second problem was unsolved by two contestants,so it is worth2points.The third problem was unsolved by four contestants,so it is worth4points.Thus the first contestant has a score of4;the second contestant(Philip),the fourth and the1621-st International Olympiad In Informatics fifth contestants all have a score of3;and the third contestant has a score of1. Contestants2,4and5are all tied according to thefirst tie-break rule(number of problems solved),and according to the second tie-break rule(smaller ID)Philip ranks before the others.Thus Philips rank in thefinal standings is2.He is only behind the contestant with ID1.Task1.4RAISINS(proposed by Emil Kelevedjiev)Plovdiv’s famous master chocolatier Bonny needs to cut a slab of chocolate with raisins.The chocolate is a rectangular block of identical square pieces.The pieces are aligned with the edges of the chocolate,and they are arranged in N rows and M columns,for a total of N∗M pieces.Each piece has one or more raisins on it,and no raisins lie between or across pieces.Initially,the chocolate is one single,monolithic block.Bonny needs to cut it into smaller and smaller blocks untilfinally she has cut the chocolate down to its N∗M individual pieces.As Bonny is very busy,she needs the help of her assistant, Sly Peter,to do the cutting.Peter only makes straight line,end-to-end cuts and he wants to be paid for every single cut he makes.Bonny has no money at hand, but she has plenty of raisins left over,so she offers to pay Peter in raisins.Sly Peter agrees to this arrangement,but under the following condition:every time he cuts a given block of chocolate into two smaller blocks,he has to be paid as many raisins as there are on the block he was given.2009August8-15,Plovdiv,Bulgaria17 Bonny wants to pay Peter as little as possible.She knows how many raisins there are on each of the N∗M pieces.She can choose the order in which she gives Peter any remaining blocks,and she can also tell Peter what cuts to make (horizontal or vertical)and where exactly to make them.Help Bonny decide how to cut the chocolate into individual pieces,so that she pays Sly Peter as few raisins as possible.TASKWrite a program that,given the number of raisins on each of the individual pieces,determines the minimum number of raisins that Bonny will have to pay Sly Peter.CONSTRAINTS1≤N,M≤50–The number of pieces on each side of the chocolate1≤R k,p≤1000–The number of raisins on the piece in the k th row andthe p th columnINPUTYour program must read from standard input the following data:•Thefirst line contains the integers N and M,separated by a single space.•The next N lines describe how many raisins there are on each piece of the chocolate.The k th of these N lines describes the k th row of the chocolate.Each such line contains M integers separated by single spaces.The integers describe the pieces on the corresponding row in order from left to right.The p th integer on the k th line(among these N lines)tells you how many raisins are on the piece in the k th row and the p th column.OUTPUTYour program must write to standard output a single line containing a single integer:the minimum possible number of raisins that Bonny would have to pay Sly PeterGRADINGFor a number of tests,worth a total of25points,N and M will not exceed7.1821-st International Olympiad In Informatics EXAMPLESample Input Sample Output2327577195One possible way(out of many)to achieve a cost of77is as follows:Thefirst cut that Bonny asks Peter to make separates the third column from the rest of the chocolate.Bonny needs to pay Peter29raisins for this.Then Bonny gives Peter the smaller of the two blocks:the one that has two pieces with5raisins each,and asks Peter to cut the block in two in exchange for 10raisins.After this,Bonny gives Peter the largest remaining block:the one having pieces with2,7,1and9raisins respectively.Bonny asks Peter to cut it horizontally, separating thefirst and the second row and pays him19raisins.Following this,Bonny gives Peter the top-left block,paying9raisins.Finally, Bonny asks Peter to split the bottom-left block,paying10raisins.The total cost to Bonny is29+10+19+9+10=77raisins.No other cutting arrangement can get the chocolate cut into its6pieces at a smaller cost.2009August8-15,Plovdiv,Bulgaria19 TECHNICAL INFO SHEET(day1)These pages contain helpful information on how to avoid slow input/output performance with C++streams(cin/cout),how to use64-bit data types(vari-ables)and how toflush the output for interactive tasks.They also include reference for what options are given to the compilers and what stack limitations are in place.Slow Input/Output with C++StreamsWhen solving tasks with very large amounts of input/output data,you may notice that C++programs using the cin and cout streams are much slower than equivalent programs that use the scanf and printf functions for input and output processing.Thus,if you are using the cin/cout streams we strongly recommend that you switch to using scanf/printf instead.However,if you still want to use cin /cout,we recommend adding the following line at the beginning of your program:ios::sync_with_stdio(false);and also making sure that you never use endl,but use\n instead.Please note,however,that including ios::sync_with_stdio(false)breaks the synchrony between cin/cout and scanf/printf,so if you are using this,you should never mix usage of cin and scanf,nor mix cout and printf.64-bit Data TypesFor some tasks you may need to deal with numbers too large tofit in32bits. In these cases,you would have to use a64-bit integer data type,such as long long in C/C++or int64in Pascal.Here is some sample code that illustrates the usage of these data types:C/C++int main(void){long long varname;scanf("%lld",&varname);//Do something with the varname variableprintf("%lld\n",varname);return0;}2021-st International Olympiad In Informatics Pascalvarvarname:Int64;beginread(varname);{Do something with the varname variable}writeln(varname);end.Flushing the OutputWhenever you solve an interactive task,you always need toflush the buffer of your output after every new line printed on the output.Here is some code to illustrate how to do this under C,C++and Pascal:C or C++with scanf/printffflush(stdout);C++with cin/coutcout<<flush;Pascalflush(output);Compiler OptionsThe following commands will be used to compile solutions of batch and inter-active tasks(say the task name is abc):Cgcc-o abc abc.c-std=gnu99-O2-s-static-lm-x cC++g++-o abc abc.cpp-O2-s-static-lm-x c++Pascalfpc-O2-XS-Sg abc.pas。
2009noip提高组复赛题解
NOIP2009提高組複賽試題解題報告NOIP2009提高組複賽試題解題報告一、潛伏者(spy)問題描述:給出密文及對應明文,求字母的對應關係並破譯密文。
解題思路:水題。
只需把字符串掃描一遍,邊掃邊增加對應關係。
並判斷既有之對應關係是否正確。
最後判斷是否每一個字母都有其對應字母。
需要注意不僅要判斷是否每一個密文字母都存在惟一對應的明文字母,還要判斷是否每一個明文字母都存在惟一對應的密文字母。
(去年我沒判斷這個,所以測試點三WA了,九十分)最後若失敗輸出“Failed”,否則按照對應字母輸出即可。
建議時間:15-25分鐘題很簡單,就是要考慮全面一些,第一題的分不能錯過。
盡量多調試一下。
二、Hankson的趣味題題目描述:已知x和a0的最大公約數是a1,x和b0的最小公倍數是b1。
求x的解的個數。
解題思路:算法一:最簡單的方式是枚舉,x從a1取到b1,然後判斷x是否為解。
這種方法能得到一少半分數,因為數很大。
優化:由於x必是a1的倍數,亦必是b1的約數,所以枚舉時可以枚舉a1的倍數,判斷是否為b1的約數,然後再輾轉相除驗證解。
另外b1/2至(b1-1)之間沒必要枚舉,可去除這段區間。
(我去年這樣得到了五十分)算法二:考慮素因數的性質:若gcd(x,a0)=a1,x、a0和a1含有某一素因數p的個數分別為r、s和t,則必有t=min(r,s)。
故x含有p的個數滿足:若s=t則r>=s;若s>t則r=s;由最小公倍數亦可得到(設u、v分別為b0、b1含p的個數):若u=v則r<=v;若u<v則r=v;如此便得到了r的取值範圍,進而得到r可取值的個數。
這樣的話,就可以將a0和b1分解質因數,並對每個質因數都計算一次r的解數。
依乘法原理,將它們相乘即可得到答案。
這種方法可得到80分左右。
為了減少分解時的冗餘判斷,加快分解的速度,可以預處理出五萬以內的素數表(約五千多個)。
這樣就可以拿到滿分。
NOIP2009提高组复赛题解
1、潜伏者program spy;varv: array['A'..'Z'] of boolean; p, q: array['A'..'Z'] of char; a, b: string;j: char;i: integer;procedure stop;beginwriteln('Failed');close(input);close(output);halt;end;beginassign(input, 'spy.in');reset(input);assign(output, 'spy.out'); rewrite(output);readln(a);readln(b);fillchar(v, sizeof(v), 0);for i := 1 to length(a) do beginv[a[i]] := true;p[a[i]] := b[i];q[b[i]] := a[i];end;for j := 'A' to 'Z' doif not v[j] then stop;for i := 1 to length(a) do beginif p[a[i]] <> b[i] then stop; if q[b[i]] <> a[i] then stop; end;readln(a);for i := 1 to length(a) do write(p[a[i]]);writeln;close(input);close(output);end.2、Hankson的趣味题思路1:根据最大公约数的定义,X必定为最大公约数的倍数,那么我们可以去枚举a1的倍数,然后去验证最大公约数和最小公倍数是否符合条件。
期待分数:50。
程序1:vara0,a1,b0,b1,i,j,n,k,x,tot:longint;function gcd(a,b:longint):longint;beginif b=0 then exit(a) else exit(gcd(b,a mod b));end;beginreadln(n);for k:=1 to n dobegintot:=0;readln(a0,a1,b0,b1);for i:=1 to (b1 div a1) dobeginx:=i*a1;if b1 mod x=0 thenif gcd(a0,x)=a1 thenif (b0*x) div (gcd(b0,x))=b1 then begin inc(tot); end;end;writeln(tot);end;end.思路2:根据最小公倍数和最大公约数分解质因数指数的特殊关系进行优化。
NOIP2009复赛模拟-普及组3(常州一中)
NOIP2009复赛模拟-普及组3(常州一中)3小时,400分一、游戏[问题描述]Atlantis Island沉没以前,传说中的猫老大和King是好朋友……King很喜欢赌博,这次King和老朋友猫老大多年不见,于是便邀请猫老大来玩一个游戏,猫老大应邀参加了。
King 拿出了n块黄金(0<n<10^1000002),猫老大暗自想:咋来这么多钱的……,现在King和猫老大轮流从黄金中拿走一些,每人每次拿走的块数是2的次方(例如1,2,4,8,16……)谁能拿走最后一个黄金,谁就获胜。
现在King让猫老大先拿,双方都使用最好的策略来玩的话,谁能取得胜利呢?现在请你来帮助猫老大,他能胜利吗?[输入]一行一个数n(0<n<10^1000002)。
[输出]第一行:如果King必胜则输出“King will win.”;否则输出“MaoLaoDa will win.”。
如果是猫老大必胜的话,则再在第二行输出他第一次拿的数量,输出最小值。
[样例1]atlantis.in8atlantis.outMaoLaoDa will win.2[样例2]atlantis.in3atlantis.outKing will win.二、储蓄[问题描述]光光的手上有n元钱。
光光想利用这n 元钱去储蓄,以得到更多的钱。
光光于是就每天出入银行存取款。
光光每天需要做两件事情:存款与取款。
光光先取款(如果有到期的定期),然后给出存款额与存期、利率。
存期的单位是天,利率表示总共能得到的利率,也就是取的钱=存款额*(1+利率),每次都去尾取整。
利率单位是百分之一。
如果定期到帐,则随时还到光光手中。
光光每天必须去且只能去一趟银行。
但由于光光乱来,所以有时候会出现存款没钱。
这时候需要你输出一行“ERROR”,并且省略掉这一行。
否则输出一行“OK”。
光光想要知道,他到第k天存钱之后还有多少现金在自己手中。
[输入]输入文件bank.in,包含:第1行:n和k,其中k代表光光总共跑银行的天数。
NOIP历年复赛提高组试题(2004-2013)
第十届全国信息学奥林匹克分区联赛(NOIP2004)复赛试题(提高组竞赛用时:3小时)1、津津的储蓄计划(Save.pas/dpr/c/cpp)【问题描述】津津的零花钱一直都是自己管理。
每个月的月初妈妈给津津300元钱,津津会预算这个月的花销,并且总能做到实际花销和预算的相同。
为了让津津学习如何储蓄,妈妈提出,津津可以随时把整百的钱存在她那里,到了年末她会加上20%还给津津。
因此津津制定了一个储蓄计划:每个月的月初,在得到妈妈给的零花钱后,如果她预计到这个月的月末手中还会有多于100元或恰好100元,她就会把整百的钱存在妈妈那里,剩余的钱留在自己手中。
例如11月初津津手中还有83元,妈妈给了津津300元。
津津预计11月的花销是180元,那么她就会在妈妈那里存200元,自己留下183元。
到了11月月末,津津手中会剩下3元钱。
津津发现这个储蓄计划的主要风险是,存在妈妈那里的钱在年末之前不能取出。
有可能在某个月的月初,津津手中的钱加上这个月妈妈给的钱,不够这个月的原定预算。
如果出现这种情况,津津将不得不在这个月省吃俭用,压缩预算。
现在请你根据2004年1月到12月每个月津津的预算,判断会不会出现这种情况。
如果不会,计算到2004年年末,妈妈将津津平常存的钱加上20%还给津津之后,津津手中会有多少钱。
【输入文件】输入文件save.in包括12行数据,每行包含一个小于350的非负整数,分别表示1月到12月津津的预算。
【输出文件】输出文件save.out包括一行,这一行只包含一个整数。
如果储蓄计划实施过程中出现某个月钱不够用的情况,输出-X,X表示出现这种情况的第一个月;否则输出到2004年年末津津手中会有多少钱。
【样例输入1】29023028020030017034050908020060【样例输出1】-7【样例输入2】29023028020030017033050908020060【样例输出2】1580【问题描述】在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。
(完整word版)2009年全国高中数学联赛试题及答案,推荐文档
2009 年全国高中数学联赛受中国数学会委托,2009 年全国高中数学联赛由黑龙江省数学会承办。
中国数学会普及工作委员会和黑龙江数学会负责命题工作。
2009 年全国高中数学联赛一试命题范围不超出教育部2000 年《全日制普通高级中学数学教学大纲》中所规定的教学要求和内容,但在方法的要求上有所提高。
主要考查学生对基础知识和基本技能的掌握情况,以及综合和灵活运用的能力。
全卷包括8 填空题和3 道大题,满分100 分。
答卷时间为80 分钟。
全国高中数学联赛加试命题范围与国际数学奥林匹克接轨,在知识方面有所扩展,适当增加一些竞赛教学大纲的内容。
全卷包括4 道大题,其中一道平面几何题,试卷满分200 分。
答卷时问为150 分钟。
、填空(每小题 7分,共56 分) f f fL f x,贝U f 99 11 4 442 4 4 雄n2 22. 已知直线L:x y 9 0和圆M :2x 2yC 为圆M 上两点,在 ABC 中, BAC 45 , 为 .y > 03. 在坐标平面上有两个区域 M 和N , M 为y w x , N 是随t 变化的区域,它由y w 2 x不等式t w x w t 1所确定,t 的取值范围是 0 w t w 1,贝y M 和N 的公共面积是函数 f t .1 1 1 14.使不等式 La 2007-对一切正整数n 都成立的最小正整数n 1 n 2 2n 13a 的值为 _____ .2 25. 椭圆—2 爲1 a b 0上任意两点 P , Q ,若OP OQ ,则乘积|OP OQ|的a b最小值为 _____ .6.若方程lgkx 2lg x 1仅有一个实根,那么 k 的取值范围是 _________________ .7. 一个由若干行数字组成的数表,从第二行起每一行中的数字均等于其肩上的两个数 之和,最后一行仅有一个数,第一行是前 100个正整数按从小到大排成的行,则最后一行的 数是 (可以用指数表示)8. 某车站每天8: 00〜9: 00, 9: 00〜10: 00都恰有一辆客车到站,但到站的时刻是随 机的,且两者到站的时间是相互独立的,其规律为到站时刻8:108:308:509:109: 309: 50概率111623一旅客8: 20到车站,则它候车时间的数学期望为 __________ (精确到分) 二、解答题2 21. (14分)设直线l : y kx m (其中k , m 为整数)与椭圆 ——1交于不同两16 122 2点A , B ,与双曲线—也1交于不同两点 C , D ,问是否存在直线l ,使得向量4 12AC BD 0 ,若存在,指出这样的直线有多少条?若不存在,请说明理由.8x 8y 1 0 ,点A 在直线L 上,B ,AB 过圆心M ,则点A 横坐标范围1.若函数(n)X2,,数列a n2. (15 分)已知p , q q 0是实数,方程x px q 0有两个实根满足a i p , a2 p2 q , a. pa n 1 qa. 2 n 3,4, L(I )求数列a n的通项公式(用,表示);1(H )若p 1, q —,求a n的前n项和.43. (15分)求函数y 宀―27 • 13—x .. x的最大和最小值.加试一、解答题(共4小题,每小题50分,共200分)1、如图,M , N分别为锐角三角形ABC ( A B )的外接圆中点•过点C作PC II MN交圆于P点,I为ABC的内心,连接T •⑴求证:MP MT NP NT ;⑵在弧A B (不含点C )上任取一点Q ( Q工A , T , B ),记心分别为I i, I2,求证:Q , I i , I2, T四点共圆.2、求证不等式:1In n w , n 1 , 2,2上弧B C、A C的PI并延长交圆于AQC , △ QCB 的内k 1 k2 1PAB13、设k , l是给定的两个正整数•证明:有无穷多个正整数m > k,使得c m与l互素.4、在非负数构成的39数表X11X12X13X14X15X16X17X18X19P X21X22X23X24X25X26X27X28X29X31X32X33X34X35X36X37X38X39中每行的数互不相同,前 6 列中每列的三数之和为1,x17 x28 x39 0,x27,x37,x18,x38,X19,X29均大于•如果P的前三列构成的数表X 11X12X13S X21X22X23X31X32X33x1k满足下面的性质(O):对于数表P 中的任意一列x2k( k 1 ,2,…,9)均存在某个x3ki 1 ,2,3 使得⑶x ik< u i minx i1 ,x i 2,x i 3求证:(i)最小值u i min xi1,x i2,x i3 ,i 1,2,3一定自数表S的不同列.(11)存在数表P 中唯一的一列x1k*x2k* ,k*x3k*丰1 ,2,3 使得33数表X11 X12 X1k*S X21 X22 X2k*X31 X32 X3k* 仍然具有性质(O) •2009年全国高中数学联合竞赛一试试题参考答案及评分标准说明: 1.评阅试卷时,请依据本评分标准,选择题只设7分的0分两档;其它各题的评阅,请严 格按照本评分标准的评分档次给分,不要增加其他中间档次。
noip2009复赛普及组解题报告
noip2009复赛普及组解题报告多项式输出问题转述:给出一个一元多项式各项的次数和系数,按照规定的格式要求输出该多项式。
分析:普及组的水题。
多项式大家应该很熟悉,输出的时候注意一下几点即可:1. 最高次项为正的话开头无加号。
2. 系数为0不输出。
3. 一次项输出x,并非x^1。
4. 非常数项系数为1或-1时直接输出正负号,但是常数项需要输出该数字。
其中除第三项外其它均可在样例中检查出错误,但是若没想到第三点那么就只能得到50分了。
程序:var i,k,n:longint;beginassign(input,'poly.in');reset(input);assign(output,'poly.out');rewrite(output);readln(n);for i:=n downto 0 dobeginread(k);if k=0 then continue;if (k>0) and (i<>n) then write('+');if i=0 then write(k)else if (abs(k)<>1) then write(k) else if k=-1 then write('-');if i<>0 thenif i=1 then write('x')else write('x^',i);end;writeln;close(input);close(output);end.---------------------------------------------------------------------分数线划定问题转述:给出录取人数及所有面试者成绩,考号。
求出分数线和实际录取人数,并按成绩降序,若成绩相同则考号升序的规则输出录取人考号与成绩。
(NOIP2009)复赛模拟试题
金华一中信息学奥林匹克联赛(NOIP2009)复赛模拟试题(十五)一、题目概览二、运行内存限制1.不怕噩梦【题目描述】蚊子最近经常做噩梦,然后就会被吓醒。
这可不好。
疯子一直在发愁,然后突然有一天,他发现蚊子其实就是害怕某些事。
如果那些事出现在她的梦里,就会害怕。
我们可以假定那个害怕的事其实是一个字符串。
而她做的梦其实也是一个字符串。
她可以一个晚上一直做梦,所以梦这个字符串会很长,如果其中包含了她所害怕的事情,那么她这天晚上就会害怕。
当然一个害怕的事也可能在这天晚上被她梦到很多遍,当然每个晚上也可能有很多种害怕的事都被梦到。
每个害怕的事都有一定的权值。
而这天晚上如果梦到了某件事,那么这件事所产生的黑暗效果等于这件事的权值乘以这个害怕的事在梦字符串里的开始位置。
如果同样的事梦到了很多遍,那么就重复上面的操作很多遍。
当天晚上的黑暗效果总和等于当天所有害怕的事产生的黑暗效果累加到一起。
现在疯子想知道蚊子这些天来噩梦的黑暗效果总和是多少。
【输入格式】:第1行两个整数N,M代表一共有N天梦和M个害怕的事。
第2行到第M+1行。
每行一个字符串ti,代表第I个害怕的事第M+2行到第2M+2行。
每行一个整数ai.代表第I个害怕的事权值第2M+3行到第N+2M+3行。
每行一个字符串si,代表第I天的梦。
【输出格式】SUMSUM=N天里黑暗效果的总和。
我们保证每天的黑暗效果都小于maxlongint;【输入样例】2 2abcdef12abcdefdefabc【输出样例】15【友情提示】1*1+2*4+1*4+2*1=15对于数据的把握和时间复杂度的估计是成败的关键。
如果出现一个梦是:ab而害怕的事有a,b,ab,那么a,b,ab都需要参与计算..【数据规模】对于30%的数据N,M<=50对于所有的数据N<=200.M<=200. length(si)<=200.length(ti)<=200.ai<=10.2.那23个路口【题目描述】故事的起源不加赘述,那23个路口。
1999-2009NOIP提高组复赛试题汇编
NOIP 19981.火车从始发站(称为第1站)开出,在始发站上车的人数为a ,然后到达第2站,在第2站有人上、下车,但上、下车的人数相同,因此在第2站开出时(即在到达第3站之前)车上的人数保持为a 人。
从第3站起(包括第3站)上、下车的人数有一定规律:上车的人数都是前两站上车人数之和,而下车人数等于上一站上车人数,一直到终点站的前一站(第n-1站),都满足此规律。
现给出的条件是:共有N 个车站,始发站上车的人数为a ,最后一站下车的人数是m (全部下车)。
试问x 站开出时车上的人数是多少?2.设有n 个正整数(n ≤20),将它们联接成一排,组成一个最大的多位整数。
例如:n=3时,3个整数13,312,343联接成的最大整数为:34331213又如:n=4时,4个整数7,13,4,246联接成的最大整数为:74246133.著名科学家卢斯为了检查学生对进位制的理解,他给出了如下的一张加法表,表中的字母代表数字。
例如:其含义为:L+L=L ,L+K=K ,L+V=V ,L+E=E K+L=K ,K+K=V ,K+V=E ,K+E=KL E+E=KV根据这些规则可推导出:L=0,K=1,V=2,E=3同时可以确定该表表示的是4进制加法NOIP 1999第一题拦截导弹某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统。
但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能高于前一发的高度。
某天,雷达捕捉到敌国的导弹来袭。
由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹。
输入导弹依次飞来的高度(雷达给出的高度数据是不大于30000的正整数),计算这套系统最多能拦截多少导弹,如果要拦截所有导弹最少要配备多少套这种导弹拦截系统。
样例:INPUTOUTPUT389207155300299170158656(最多能拦截的导弹数)2(要拦截所有导弹最少要配备的系统数)输入:a ,n ,m 和x输出:从x 站开出时车上的人数。
2009年北京市中学生数学竞赛高一年级复赛试题及解答
2009年北京市中学生数学竞赛高一年级复赛参考解答一、填空题(满分40分,每小题8分,将答案写在下面相应的空格中)题 号 1234 5答 案3π 4334(6)3π-4(1,0),(−3,4),31(,)22- 1.已知a 和b 都是单位向量,并且向量2c a b =+ 与54d a b =- 互相垂直,则a 和b之间的角<,a b>= .答:3π解 设a 和b 之间的角<,a b>=θ,则根据向量垂直的条件得: ()()220(2)(54)51048c d a b a b a a b a b b =⋅=+-=+⋅-⋅-=5+6cos θ−8=6cos θ−3,由此cos θ=12,所以 θ=3π. 2.11cos 2903sin 250+的值是 . 答:43.3解 11cos 2903sin 250+ =113sin 70cos70cos703sin 703sin 70cos70--=31sin 70cos 70sin 70cos30cos 70sin 302233sin140sin14044--==4s i n (7030)43s i n 40433s i n 4033s i n 40-===. 3.如图,过⊙O 外一点M 引圆的切线切圆于点B ,连接MO 交圆于点A ,已知MA = 4厘米,MB =43厘米.N 为 AB 的中点.曲边三角形(阴影部分)的面积等于 平方厘米.答:4(6)3π-.解 根据条件, 延长MO 交圆于C , 设圆的半径为r ,MC = 4+2r 由切割线定理得 MB 2= MA ·MC ,即48= 4(4+2r ) 解得r = 4 cm ,OC =OA =AM = 4cm连接OB ,在直角△OBM 中,433sin 82MB MOB OM ∠=== A N BMOC B A bac O rD所以∠MOB =60°,因此 AB 为60°,而N 为 AB 的中点, 30AN = ,连接ON ,则∠MON =30°,所以111sin 30848222MON S OM ON ∆=⋅⋅⋅=⨯⨯⨯= (cm 2).而扇形AON 的面积230443603ππ=⨯=(cm 2),所以阴影图形的面积42444(6)8333πππ--=-==(cm 2). 4.332014220142++-的值是 . 答:4解 设332014220142x ++-=则x 3=333201423(20142)(20142)(2014220142)20142+++-⨯++-+-= 40+6x即 36400x x --= 观察之,4为方程的一个根,所以2(4)(410)0x x x -++= 由24410240∆=-⨯=-<,方程2410x x ++= 0无实根. 所以 方程36400x x --=只有唯一的实根4x = 即得证3320142201424x ++-==.5.在平面直角坐标系中,不论m 取何值时,抛物线y =mx 2+(2m +1)x −(3m +2)都不通过的直线y =−x +1上的点的坐标是 .(写出全部符合条件点的坐标)答:(1,0),(−3,4),41(,)33- 解 由 y =mx 2+(2m +1)x −(3m +2)=m (x +3)(x −1)+(x −2)可知抛物线一定过点A (1, −1),B (−3, −5).过点A 、B 分别作y 轴的平行线交直线y =−x +1于点C (1, 0),D (−3, 4).过A 、B 两点的直线与直线y =−x +1交于点E 31(,)22-. 则C 、D 、E 三点满足条件. 二、(满分15分)直角△ABC 内切圆的半径为r ,直角的平分线的长为t .求证:直角△ABC的两条直角边的长a 和b 是关于x 的一元二次方程222(22)2220t r x r x tr -+-=的根.证明 设直角△ABC 中,∠C =90°,边长AB =c ,AC =b ,CB =a ,∠C 的平分线CD =t ,内切圆的圆心为O ,内切圆半径为r .连接OA ,OB ,OC ,S △ABC =12ab (1)又 S △ABC = S △ADC + S △BDC =12bt sin45°+12at sin45°=24t (a +b )所以, ab =12t (a +b ) (2)B (−3,−5)A (1,−1)D (−3,4)E (43,−13) C (1,0) y =−x +1x y A N BM O C又 S △ABC = S △OBC + S △OAC + S △OAB =12r (a +b +c )=12r (a +b +a +b −2r )= r (a +b −r )= (a +b )r −r 2,与(1)比较得 ab =2(a +b )r −2r 2 (3) 联立(2)与(3)解得a +b ,ab 得22222,2222r tr a b ab r t r t+==-- 所以根据韦达定理,以a 和b 为根的一元二次方程为22222202222r tr x x r t r t-+=--即方程 222(22)2220t r x r x t r -+-=. 三、(满分15分)求函数f :Z +→Z +,使得① f (1)=1;② 对于所有x , y ∈ Z +,()()()f x y f x f y xy +=++都成立.解 设函数f :Z +→Z +,满足① f (1)=1;② 对于所有x , y ∈ Z +,()()()f x y f x f y xy +=++对于正整数,n m ,下列的等式成立2(2)2()f n f n n =+2(3)()(2)2f n f n f n n =++, 2(4)()(3)3f n f n f n n =++, …… …… …… ……()2()()(1)(1)f mn f n f m n m n =+-+- 将上面的等式相加,得()2()()123(1)f mn mf n m n =+++++-由于(1)123(1)2m m m -++++-=, 所以2(1)()()2m m f mn mf n n -=+,对所有的正整数m 和n 都成立. 特别是,当n =1时(1)()2m m f m += (*)等式(*)定义了在正整数集合上的函数f .因为1(11)(1)12f +== 22()(1)()()2()22x y x y x x y y xyf x y ++++++++==(1)(1)()()22x x y y xy f x f y xy ++=++=++所以(1)()2m m f m +=是问题的唯一解..ONCDA B K M 四、(满分15分)如图所示,在平行四边形ABCD 中,∠BAD 的平分线交BC 于点M ,交DC 的延长线于点N ,△CMN 的外心为O ,△CMN 的外接圆与△CBD 的外接圆的另一交点为K .证明:(1) 点O 在△CBD 的外接圆上; (2) ∠AKC =90°.证明 (1)由于平行四边形ABCD 中,∠BAD 的平分线交BC 于点M ,交DC 的延长线于点N ,所以∠BMA =∠MAD =∠BAM ,因此BA=BM ,同理可得MC=CN .连接OC ,则OC 平分∠NCM .连接OB ,OM ,OD ,设∠BAD = θ,则∠OCD =∠BCD +∠OCM = θ +12(180°−θ) = 90°+2θ∠BMO =180°−∠OMC =180°−∠OCM =90°+2θ,所以 ∠BMO =∠OCD .因此,△OBM ≌△ODC ,所以∠OBC =∠ODC .于是B ,O ,C ,D 四点共圆,也就是点O 在△CBD 的外接圆上.…(8分)(2) 由(1)知 BO=OD ,又KO=OC ,因为B ,K ,O ,C 和D 都在同一个圆上,则K ,C 关于BD 的中垂线对称,BK=CD=AB ,又∠KBD =∠CDB =∠ABD ,所以点K 与点A 是关于BD 的对称点,即AK ⊥BD ,而KC//BD ,所以AK ⊥KC ,即∠AKC =90°. 五、(满分15分)证明,在任意给出的7个实数中,一定能找到两个实数x ,y ,使得 0≤1x y xy -+≤33. 证明 设任意给出的7个实数为1234567,,,,,,a a a a a a a ,在,22ππ⎛⎫- ⎪⎝⎭内存在7个实数1234567,,,,,,θθθθθθθ,使得tan i i a θ= 其中(1,2,3,4,5,6,7)i =.将,22ππ⎛⎫- ⎪⎝⎭等分为6个长为6π的区间:,,,,0,0,,,,,2336666332ππππππππππ⎛⎫⎡⎤⎛⎫⎡⎤⎛⎤⎛⎫----- ⎪ ⎪ ⎪⎢⎥⎢⎥⎥⎝⎭⎣⎦⎝⎭⎣⎦⎝⎦⎝⎭, 根据抽屉原理,必存在,i j θθ属于同一个长为6π的小区间,不妨设i j θθ≥,则 06i j πθθ≤-≤,因此0t a n ()t a n 6i j πθθ≤-≤即 t a n t a n 301t a n t a n3i j ij θθθθ-≤≤+.令x =a i ,y =a j ,这样,我们从任意给出的7个实数中,找到了两实数x ,y ,使得 0≤1x y xy -+≤33.。
全国信息学奥林匹克联赛(NOIP2009)复赛
全国信息学奥林匹克联赛(NOIP2009)复赛提高组(请选手务必仔细阅读本页内容)三.编译命令(不包含任何优化开关)五.注意事项1、文件名(程序名和输入输出文件名)必须使用小写。
2、C/C++中函数main()的返回值类型必须是int,程序正常结束时的返回值必须是0。
3、全国统一评测时采用的机器配置为:CPU 1.9GHz,内存1G,上述时限以此配置为准。
各省在自测时可根据具体配置调整时限。
1.潜伏者(spy.pas/c/cpp)【问题描述】R国和S国正陷入战火之中,双方都互派间谍,潜入对方内部,伺机行动。
历经艰险后,潜伏于S国的R国间谍小C终于摸清了S国军用密码的编码规则:1、S国军方内部欲发送的原信息经过加密后在网络上发送,原信息的内容与加密后所的内容均由大写字母‘A’—‘Z’构成(无空格等其他字母)。
2、S国对于每个字母规定了对应的“密字”。
加密的过程就是将原信息中的所有字母替换为其对应的“密字”。
3、每个字母只对应一个唯一的“密字”,不同的字母对应不同的“密字”。
“密字”可以和原字母相同。
例如,若规定‘A’的密字为‘A’,‘B’的密字为‘C’(其他字母及密字略),则原信息“ABA”被加密为“ACA”。
现在,小C通过内线掌握了S国网络上发送的一条加密信息及其对应的原信息。
小C 希望能通过这条信息,破译S国的军用密码。
小C的破译过程是这样的:扫描原信息,对于原信息中的字母x(代表任一大写字母),找到其在加密信息中的对应大写字母y,并认为在密码里y是x的密字。
如此进行下去直到停止于如下的某个状态:1、所有信息扫描完毕,‘A’—‘Z’所有26个字母在原信息中均出现过并获得了相应的“密字”。
2、所有信息扫描完毕,但发现存在某个(或某些)字母在原信息中没有出现。
3、扫描中发现掌握的信息里有明显的自相矛盾或错误(违反S过密码的编码规则)。
例如某条信息“XYZ”被翻译为“ABA”就违反了“不同字母对应不同密字”的规则。
NOIP测试二
下落(fall)[问题描述]在直角坐标系上,有一个小球开始从坐标(x,y) x>0,y>0 处直线下落,每一秒钟一个单位距离,一直到X轴为止。
然而,它可能在下落过程中碰到一些障碍物。
障碍物可以看成是一些平行于X轴的水平线段,如果小球的Y坐标和障碍物的Y坐标相等,而X坐标在障碍物的两个端点X坐标之间(包括两个端点),这样小球就会延时5秒然后从障碍物的右端继续下落。
现给出小球的初始坐标 (x,y) ,以及每个障碍物的数据(三个整数 y x1 x2,分别表示这个障碍物的Y坐标,左、右端点的X坐标),编程求小球要几称钟才能到达X 轴上。
[输入文件:fall.in]第一行有两个整数x y表示小球初始坐标,1<=x,y<=1000。
第二行有一个整数n(n<100),表示有n个障碍物。
下面有n行,每行三个整数(都在1到999之间),分别表示一个障碍物的数据(y x1 x2),其中x1<=x2。
障碍物的高度都不相同。
[输出文件:fall.out]只一个整数,小球下落到X轴的秒数。
[样例:]变音量(song)[问题描述]你将要在元旦演奏一场吉他专场。
但你不希望声音平淡,所以你希望每个曲之间都有变化。
现在你已经确定了每个曲可以与上一个曲之间的音量的变化量,即每首曲开始,你可以对音量选择增加或减少一个指定的变化值。
当然音量不可能为负数,也不能太高,因此必需保证每首曲音量在0和maxLevel之间(包含)。
你的任务是,根据已有的开始音量beginLevel 和每首曲之间的变化量,求出最后一首曲的最大可能音量。
如果没有方案,输出 -1。
[输入文件:song.in]文件第一行有三个整数,n, beginLevel, maxLevel,分别表示曲目数,开始量,最大限制音量。
下面有n-1行整数,第i行整数表示第i首曲与第i+1首曲之间的变化量。
[输入文件:song.in]文件只一行一个数,答案。
2009年第50届国际数学奥林匹克竞赛试题(中文版)与参考答案
2009年第50届国际数学奥林匹克竞赛试题(中文版)与参考答案2009年第50届IMO解答2009年7月15日1、是一个正整数,是n12,,...,(2)kaaak≥{}1,2,...,n中的不同整数,并且1(1iinaa+.对于所有都成立,证明:1,2,...,1ik=1(1kaa.不能被n整除。
证明1:由于12(1naa.,令1(,)nap=,nqp=也是整数,则npq=,并且1pa,21qa.。
因此,由于2(,)1qa=23(1npqaa=.,故31qa.;同理可得41qa.,。
,因此对于任意都有2i≥1iqa.,特别的有1kqa.,由于1pa,故1(1knpqaa=.(*)。
若结论不成立,则1(1knpqaa=,与(*)相减可得1(knaa.,矛盾。
综上所述,结论成立。
此题平均得分:4.804分2、外接圆的圆心为O,分别在线段上,ABCΔ,PQ,CAAB,,KLM分别是,,BPCQPQ的中点,圆过Γ,,KLM并且与相切。
证明:OPPQOQ=。
*****QP证明:由已知*****QP∠=∠=∠,*****PQ∠=∠=∠,因此APQMKLΔΔ~。
所以*****QMLCP==,故*****Q.=.(*)。
设圆O的半径为R,则由(*)有222ROPROQ.=.,因此OPOQ=。
不难发现OP也是圆Γ与相切的充分条件。
OQ=PQ此题平均得分:3.710分3、是严格递增的正整数数列,并且它的子数列和都是等差数列。
证明:是一个等差数列。
123,,,...SSS123,,,...SSSSSS*****,,,.SSSSSS+++123,,,...SSS问题等价于::fZZ+→是一个严格递增的函数。
()()nbffn=是一个等差数列,也是一个等差数列。
证明:(()1ncffn=()nafn=也是等差数列。
证明:由于是一个严格递增的整值函数,所以对于任意f,xy均有()()fxfy xy.≥.。
令{}{},nnbc的公差分别为,则有,de()()(1)()(1)(dffnffnfnfn=+.≥+.,将可得()nfn→()()()1()0nndffnffncb≥+.=.,因此对于任意都有kZ+∈()()*****kkdcbcbkde++≥.=.+.故只能有,也即两个等差数列公差相等,故可设de=nncbg.=是一个为常数。
NOIP历年复赛提高组试题
全国信息学奥林匹克分区联赛(NOIP)复赛提高组试题第一届全国信息学奥林匹克分区联赛(NOIP1995)复赛试题(提高组竞赛用时:3.5小时)1、编码问题设有一个数组A:ARRAY[0..N-1]OFINTEGER;数组中存放的元素为0~N-1之间的整数,且A[i]≠A[j](当i≠j时)。
例如:N=6时,有:A=(4,3,0,5,1,2)此时,数组A的编码定义如下:A[0]的编码为0;A[i]的编码为:在A[0],A[1],…,A[i-1]中比A[i]的值小的个数(i=1,2,…,N-1)∴上面数组A的编码为:B=(0,0,0,3,1,2)程序要求解决以下问题:①给出数组A后,求出其编码。
②给出数组A的编码后,求出A中的原数据。
2、灯的排列问题设在一排上有N个格子(N≤20),若在格子中放置有不同颜色的灯,每种灯的个数记为N1,N2,……N k(k表示不同颜色灯的个数)。
放灯时要遵守下列规则:①同一种颜色的灯不能分开;②不同颜色的灯之间至少要有一个空位置。
例如:N=8(格子数);R=2(红灯数);B=3(蓝灯数),放置的方法有:R-B顺序B-R顺序放置的方法总数为12种。
数据输入的方式为:NP1(颜色,为一个字母)N1(灯的数量)P2 N2……Q(结束标记,Q本身不是灯的颜色)程序要求:求出一种顺序的放置(排列)方案及放置(排列)方案总数。
3、积木块上的数字设有一个四层的积木块,1~4层积木块的数量依次为:5,6,7,8,如下图所示放置:其中,给出第三层与第四层所标示的数字,并已知第三层的数据是由第四层的数据计算出来的。
计算的方法是:第三层的某个数据A是由第四层相邻的两个数据B,C经过某种计算后产生的:计算所用到的计算符为:+,-,⨯,且无优先级之分(自左向右计算),运算符最多为2个。
如:3+4⨯5=35 5⨯4+3=23可以看出,上图中的第三层的数据是由第四层的数据用以下计算公式计算出来的:A=B⨯C+B也就是:8=2⨯3+2,15=3⨯4+3,……14=2⨯6+2程序要求:给出第四层与第三层的数据后,将第一、二层的每块积木标上相应的数据,并输出整个完整的积木图及计算公式。
NOIP_2009复赛试题—细胞分裂
枚举每一种细胞,计算其kmin的值, 其中最小的就是题目所求。 版权所有 东华初级中学
输入输出
• 【输入】
– 输入文件名为 cell.in,共有三行。 – 第一行有一个正整数 N,代表细胞种数。 – 第二行有两个正整数 m1,m2,以一个空格隔开,m1^m2即表示试管的 总数M。 – 第三行有 N 个正整数,第i 个数Si 表示第i 种细胞经过1 秒钟可以分裂成同 种细胞的个数。
版权所有 东华初级中学
【输入输出样例 1】
cell.in 1 21 只有一种细胞 3 2个试管 1个细胞1秒钟可以分裂分裂成3个 cell.out -1 【输入输出样例1 说明】 经过 1 秒钟,细胞分裂成3 个,经过2 秒钟,细胞分裂成9 个,……,可以看出无论怎么分裂,细胞的个数都是奇数, 因此永远不能分入2 个试管。
• 【输出】
– 输出文件 cell.out 共一行,为一个整数,表示从开始培养细胞到实验能够 开始所经过的最少时间(单位为秒)。如果无论 Hanks 博士选择哪种细胞 都不能满足要求,则输出整数-1。
• 【数据范围】
– 对于所有的数据,有1 ≤N≤ 10000,1 ≤m1 ≤ 30000,1 ≤m2 ≤ 10000,1 ≤ Si ≤ 2,000,000,000。
版权所有 东华初级中学
【输入输出样例 2】
cell.in 细胞种类:2种 2 试管数M:24个=2*2*2*3=23*3 第1种细胞s1=30=2*3*5 24 1 第2种细胞s2=12=2*2*3=22*3 30 12 思考:如果s2=9,结果会怎样? cell.out 2 【输入输出样例2 说明】 第 1 种细胞最早在3 秒后才能均分入24 个试管,而第2 种最 早在2 秒后就可以均分(每 试管144/(241)=6 个)。故实验最早可以在2 秒后开始。
NOIP2009复赛模拟题
NOIP2009复赛模拟题(提高组)1.货物搬运(move.pas)输入文件:move.in输出文件:move.out时间限制:1s[问题描述]天地无情人有情,一方有难八方支援!目前灾区最紧缺的就是救灾帐篷,全国各地支援的帐篷正紧急向灾区运送。
假设围绕汶川县有环行排列的n个救灾帐篷的存储点,每个存储点存有帐篷数量分别是M1,M2,…,Mn,且S=M1+M2+…+Mn必为n的倍数。
可以在任意一个存储点中任取任意数量的帐篷搬运到相邻的存储点。
现在需要找到一种搬运方法,搬运最少的帐篷使得每个存储点中的帐篷数目相同。
例如:n=4,每个存储点帐篷的数量分别为17,9,14,16,4。
我们进行如下搬运:(1)存储点①向存储点②搬运1个帐篷;(2)存储点①向存储点⑤搬运4个帐篷;(3)存储点③向存储点②搬运2个帐篷;(4)存储点④向存储点⑤搬运4个帐篷。
M1搬运帐篷的总数量是1+4+2+4=11,并且可以证明这样的搬运方法是最佳搬运方法。
MnM3M2[输入文件]第一行一个整数n(n≤10000),表示有n储存点;第二行n个整数(integer范围)表示n个存储点中帐篷数量。
[输出文件]一个整数,表示最少搬运的帐篷数量。
[样例输入]517 9 14 16 4[样例输出]112.电话网络(phone.pas)输入文件:phone.in输出文件:phone.out时间限制:1s[问题描述]由于地震使得连接汶川县城的电话线全部损坏,假如你是负责将电话线接到震中汶川县城的负责人,汶川县城周围分布着N(1≤N≤1000)根按1..N顺次编号的废弃的电话线杆去,任意两根电话线杆间都没有电话线相连。
一共P(1≤P≤10000)对电话线杆间可以拉电话线,其余的由于地震使得无法被连接。
第i对电话线杆的两个端点分别为Ai,Bi,它们间的距离为Li(1≤Li≤1000000)。
数据保证每对(Ai,Bi)最多只出现1次。
编号为1的电话线杆已经接入了全国的电话网络,整个县城的电话线全都连到了编号为N的电话线杆上。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
换为其对应的“密字”。 3. 每个字母只对应一个唯一的“密字”,不同的字母对应不同的“密字”。“密字”可以
和原字母相同。 例如,若规定‘A’的密字为‘A’,‘B’的密字为‘C’(其他字母及密字略),则原信 息“ABA”被加密为“ACA”。 现在,小 C 通过内线掌握了 S 国网络上发送的一条加密信息及其对应的原信息。小 C 希望能通过这条信息,破译 S 国的军用密码。小 C 的破译过程是这样的:扫描原信息,对 于原信息中的字母 x(代表任一大写字母),找到其在加密信息中的对应大写字母 y,并认为 在密码里 y 是 x 的密字。如此进行下去直到停止于如下的某个状态: 1. 所有信息扫描完毕,‘A’-‘Z’ 所有 26 个字母在原信息中均出现过并获得了相应
DSLIEWO
【输入输出样例 2 说明】 字母‘Z’在原信息中没有出现,输出“Failed”。
【输入输出样例 3】 spy.in MSRTZCJKPFLQYVAWBINXUEDGHOOILSMIJFRCOPPQCEUNYDUMPP YIZSDWAHLNOVFUCERKJXQMGTBPPKOIYKANZWPLLVWMQJFGQYLL FLSO
C 国幅员辽阔,各地的资源分布情况各不相同,这就导致了同一种商品在不同城市的价 格不一定相同。但是,同一种商品在同一个城市的买入价和卖出价始终是相同的。
商人阿龙来到 C 国旅游。当他得知同一种商品在不同城市的价格可能会不同这一信息 之后,便决定在旅游的同时,利用商品在不同城市中的差价赚回一点旅费。设 C 国 n 个城 市的标号从 1~ n,阿龙决定从 1 号城市出发,并最终在 n 号城市结束自己的旅行。在旅游的 过程中,任何城市可以重复经过多次,但不要求经过所有 n 个城市。阿龙通过这样的贸易方 式赚取旅费:他会选择一个经过的城市买入他最喜欢的商品——水晶球,并在之后经过的另 一个城市卖出这个水晶球,用赚取的差价当做旅费。由于阿龙主要是来 C 国旅游,他决定 这个贸易只进行最多一次,当然,在赚不到差价的情况下他就无需进行贸易。
【输入】 输入文件名为 spy.in,共 3 行,每行为一个长度在 1 到 100 之间的字符串。 第 1 行为小 C 掌握的一条加密信息。 第 2 行为第 1 行的加密信息所对应的原信息。 第 3 行为 R 国司令部要求小 C 翻译的加密信息。 输入数据保证所有字符串仅由大写字母‘A’-‘Z’构成,且第 1 行长度与第 2 行相等。
sudoku.pas sudoku.c sudoku.cpp
三.编译命令(不包含任何优化开关)
对于 pascal 语言
fpc spy.pas
fpc son.pas
对于 C 语言 gcc -o spy spy.c gcc -o son
-lm
son.c -lm
对于 C++语言
g++ -o spy
g++ -o son
假设 C 国有 5 个大城市,城市的编号和道路连接情况如下图,单向箭头表示这条道路 为单向通行,双向箭头表示这条道路为双向通行。
假设 1~n 号城市的水晶球价格分别为 4,3,5,6,1。 阿龙可以选择如下一条线路:1->2->3->5,并在 2 号城市以 3 的价格买入水晶球,在 3 号城市以 5 的价格卖出水晶球,赚取的旅费数为 2。 阿龙也可以选择如下一条线路 1->4->5->4->5,并在第 1 次到达 5 号城市时以 1 的价格 买入水晶球,在第 2 次到达 4 号城市时以 6 的价格卖出水晶球,赚取的旅费数为 5。
水晶球价格≤100。
4.靶形数独
(sudoku.pas/c/cpp) 【问题描述】
小城和小华都是热爱数学的好学生,最近,他们不约而同地迷上了数独游戏,好胜的他 们想用数独来一比高低。但普通的数独对他们来说都过于简单了,于是他们向 Z 博士请教, Z 博士拿出了他最近发明的“靶形数独”,作为这两个孩子比试的题目。
【输出】 输出文件 trade.out 共 1 行,包含 1 个整数,表示最多能赚取的旅费。如果没有进行贸易,
则输出 0。
【输入输出样例】 trade.in 55 43561 121 141 232 351 452
trade.out 5
【数据范围】 输入数据保证 1 号城市可以到达 n 号城市。 对于 10%的数据,1≤n≤6。 对于 30%的数据,1≤n≤100。 对于 50%的数据,不存在一条旅游路线,可以从一个城市出发,再回到这个城市。 对于 100%的数据,1≤n≤100000,1≤m≤500000,1≤x,y≤n,1≤z≤2,1≤各城市
第3页共7页
全国信息学奥林匹克联赛(NOIP2009)复赛
【输入输出样例】
son.in
son.out
2
6
41 1 96 288
2
95 1 37 1776
【说明】 第一组输入数据,x 可以是 9、18、36、72、144、288,共有 6 个。 第二组输入数据,x 可以是 48、1776,共有 2 个。
【数据范围】 对于 50%的数据,保证有 1≤a0,a1,b0,b1≤10000 且 n≤100。 对于 100%的数据,保证有 1≤a0,a1,b0,b1≤2,000,000,000 且 n≤2000。
提高组
3.最优贸易
(trade.pas/c/cpp) 【问题描述】
C 国有 n 个大城市和 m 条道路,每条道路连接这 n 个城市中的某两个城市。任意两个 城市之间最多只有一条道路直接相连。这 m 条道路中有一部分为单向通行的道路,一部分 为双向通行的道路,双向通行的道路在统计条数时也计为 1 条。
靶形数独 sudoku sudoku
sudoku.in sudoku.out
2秒 20 5 有 全文比较 过滤行末空格 及文末回车 传统
二.提交源程序文件名
对于 pascal 语言
spy.pas
对于 C 语言
spy.c
对于 C++语言
spy.cpp
son.pas son.c son.cpp
trade.pas trade.c trade.cpp
靶形数独的方格同普通数独一样,在 9 格宽×9 格高的大九宫格中有 9 个 3 格宽×3 格 高的小九宫格(用粗黑色线隔开的)。在这个大九宫格中,有一些数字是已知的,根据这些
第5页共7页
全国信息学奥林匹克联赛(NOIP2009)复赛
提高组
全国信息学奥林匹克联赛(NOIP2009)复赛
提高组
全国信息学奥林匹克联赛(NOIP2009)复赛
提高组
(请选手务必仔细阅读本页内容)
一.题目概况
中文题目名称 英文题目名称 可执行文件名 输入文件名 输出文件名 每个测试点时限 测试点数目 每个测试点分值 附加样例文件 结果比较方式
题目类型
潜伏者 spy spy spy.in
四.运行内存限制
内存上限
128M
128M
128M
128M
注意事项:
1、文件名(程序名和输入输出文件名)必须使用小写。 2、C/C++中函数 main()的返回值类型必须是 int,程序正常结束时的返回值必须是 0。 3、全国统一评测时采用的机器配置为:CPU 1.9GHz,内存 1G,上述时限以此配置为准。各 省在自测时可根据具体配置调整时限。
spy.out 1秒 10 10 有
全文比较 过滤行末空格 及文末回车
传统
Hankson 的趣味题 son son
son.in son.out
1秒 10 10 有 全文比较 过滤行末空格及 文末回车 传统
最优贸易 trade trade
trade.in trade.out
1秒 10 10 有 全文比较 过滤行末空格 及文末回车 传统
全国信息学奥林匹克联赛(NOIP2009)复赛
提高组
【输入输出样例 1 说明】 原信息中的字母‘A’和‘B’对应相同的密字,输出“Failed”。
【输入输出样例 2】
spy.in
spy.out
QWERTYUIOPLKJHGFDSAZXCVBN
Failed
ABCDEFGHIJKLMNOPQRSTUVWXY
1. x 和 a0 的最大公约数是 a1; 2. x 和 b0 的最小公倍数是 b1。 Hankson 的“逆问题”就是求出满足条件的正整数 x。但稍加思索之后,他发现这样的 x 并不唯一,甚至可能不存在。因此他转而开始考虑如何求解满足条件的 x 的个数。请你帮 助他编程求解这个问题。
【输入】 输入文件名为 son.in。第一行为一个正整数 n,表示有 n 组输入数据。接下来的 n 行每
(son.pas/c/cpp) 【问题描述】
Hanks 博士是 BT (Bio-Tech,生物技术) 领域的知名专家,他的儿子名叫 Hankson。现 在,刚刚放学回家的 Hankson 正在思考一个有趣的问题。
今天在课堂上,老师讲解了如何求两个正整数 c1 和 c2 的最大公约数和最小公倍数。现 在 Hankson 认为自己已经熟练地掌握了这些知识,他开始思考一个“求公约数”和“求公 倍数”之类问题的“逆问题”,这个问题是这样的:已知正整数 a0,a1,b0,b1,设某未知正整 数 x 满足:
数目。 第二行 n 个正整数,每两个整数之间用一个空格隔开,按标号顺序分别表示这 n 个城
市的商品价格。 接下来 m 行,每行有 3 个正整数,x,y,z,每两个整数之间用一个空格隔开。如果 z=1,
表示这条道路是城市 x 到城市 y 之间的单向道路;如果 z=2,表示这条道路为城市 x 和城市 y 之间的双向道路。