Noip2014初赛提高组C试题及答案解读
- 格式:doc
- 大小:58.50 KB
- 文档页数:9
2009-2013年NOIP初赛提高组C++语言试题2013第十九届全国青少年信息学奥林匹克联赛初赛提高组C++语言试题竞赛时间:2013年10月13日14:30~16:30选手注意:试题纸共有12页,答题纸共有2页,满分100分。
请在答题纸上作答,写在试题纸上的一律无效。
不得使用任何电子设备(如计算器、手机、电子词典等)或查阅任何书籍资料。
一、单项选择题(共15题,每题1.5分,共计22.5分;每题有且仅有一个正确选项)1.一个32位整型变量占用()个字节。
A.4 B.8 C.32 D.1282.二进制数11.01在十进制下是()。
A.3.25 B.4.125 C.6.25 D.11.1253.下面的故事与()算法有着异曲同工之妙。
从前有座山,山里有座庙,庙里有个老和尚在给小和尚讲故事:?从前有座山,山里有座庙,庙里有个老和尚在给小和尚讲故事:‘从前有座山,山里有座庙,庙里有个老和尚给小和尚讲故事....’?A.枚举B.递归C.贪心D.分治4.1948年,()将热力学中的熵引入信息通信领域,标志着信息论研究的开端。
A.冯·诺伊曼(John von Neumann)B.图灵(Alan Turing)C.欧拉(Leonhard Euler)D.克劳德·香农(Claude Shannon)5.已知一棵二叉树有2013个节点,则其中至多有()个节点有2个子节点。
A.1006B.1007C.1023D.10246.在一个无向图中,如果任意两点之间都存在路径相连,则称其为连通图。
右图是一个有5个顶点、8条边的连通图。
若要使它不再是连通图,至少要删去其中的()条边。
A.2B.3C.4D.57.斐波那契数列的定义如下:F1=1,F2=1,Fn=Fn–1+Fn–2(n≥3)。
如果用下面的函数计算斐波那契数列的第n项,则其时间复杂度为()。
int F(int n){if(n<=2)return 1;elsereturn F(n-1)+F(n-2);})A.O(1)B.O(n)C.O(n2)D.O(Fn8.二叉查找树具有如下性质:每个节点的值都大于其左子树上所有节点的值、小于其右子树上所有节点的值。
NOIP2014(第二十届)初赛普及组C语言试题及答案第二十届全国青少年信息学奥林匹克联赛初赛普及组C语言试题竞赛时间:2014年10月12日14:30~16:30 选手注意:l 试题纸共有8页,答题纸共有2页,满分100分。
请在答题纸上作答,写在试题纸上的一律无效。
l 不得使用任何电子设备(如计算器、手机、电子词典等)或查阅任何书籍资料。
一、单项选择题(共20题,每题1.5分,共计30分;每题有且仅有一个正确选项)1. 以下哪个是面向对象的高级语言()。
A. 汇编语言B. C++C. FortranD. Basic 2. 1TB代表的字节数量是()。
A. 2的10次方B. 2的20次方C. 2的30次方D. 2的40次方3. 二进制数__和__的和是()。
A. __B. __0C. __D. __ 4. 以下哪一种设备属于输出设备()。
A. 扫描仪B. 键盘C. 鼠标D. 打印机5. 下列对操作系统功能的描述最为完整的是()。
A. 负责外设与主机之间的信息交换B. 负责诊断机器的故障 C. 控制和管理计算机系统的各种硬件和软件资源的使用 D. 将源程序编译成目标程序6. CPU、存储器、I/O设备是通过()连接起来的。
A. 接口B. 总线C. 控制线D. 系统文件7. 断电后会丢失数据的存储器是()。
A. RAMB. ROMC. 硬盘D. 光盘8. 以下哪一种是属于电子邮件收发的协议()。
A. SMTPB. UDPC. P2PD. FTP 9. 下列选项中不属于图像格式的是()。
A. JPEG格式B. TXT格式C. GIF格式D. PNG格式10. 链表不具有的特点是()。
A. 不必事先估计存储空间B. 可随机访问任一元素C. 插入删除不需要移动元素D. 所需空间与线性表长度成正比11. 下列各无符号十进制整数中,能用八位二进制表示的数中最大的是()。
A. 296B. 133C. 256D. 199 12. 下列几个32位IP地址中,书写错误的是()。
CCF全国信息学奥林匹克联赛(NOIP2014)复赛提高组day1(请选手务必仔细阅读本页内容)一.题目概况中文题目名称生活大爆炸版石头剪刀布联合权值飞扬的小鸟英文题目与子目录名rps link bird 可执行文件名rps link bird输入文件名rps.in link.in bird.in 输出文件名rps.out link.out bird.out 每个测试点时限1秒1秒1秒测试点数目101020每个测试点分值10105附加样例文件有有有结果比较方式全文比较(过滤行末空格及文末回车)题目类型传统传统传统运行内存上限128M128M128M二.交源程序文件名对于C++语言rps.cpp link.cpp bird.cpp 对于C语言rps.c link.c bird.c 对于pascal语言rps.pas link.pas bird.pas三.编译命令(不包含任何优化开关)对于C++语言g++-o rps rps.cpp–lm g++-o link link.cpp–lmg++-o bird bird.cpp–lm对于C语言gcc-o rps rps.c–lm gcc-o link link.c–lm gcc-o bird bird.c–lm对于pascal语言fpc rps.pas fpc link.pas fpc bird.pas注意事项:1、文件名(程序名和输入输出文件名)必须使用英文小写。
2、C/C++中函数main()的返回值类型必须是int,程序正常结束时的返回值必须是0。
3、全国统一评测时采用的机器配置为:CPU AMD Athlon(tm)64x2Dual Core CPU5200+,2.71GHz,内存2G,上述时限以此配置为准。
4、只供Linux格式附加样例文件。
5、特别提醒:评测在当前最新公布的NOI Linux下进行,各语言的编译器版本以其为准。
1.生活大爆炸版石头剪刀布(rps.cpp/c/pas)【问题描述】石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头。
NOIP提高组初赛历年试题及答案阅读题篇阅读程序写结果(共4 题,每题8 分,共计32 分)阅读程序的最好方法并非是依次从头到尾。
程序不像迷语,我们无法从末尾几页找到答案,也不像一本引人入胜的书籍,只需直接翻到褶皱最多的那几页,我们就能找到最精彩的片断。
因此我们在阅读程序时,最好逐一考察研究每一段代码,搞清楚每一段代码的来龙去脉,理解每一段代码在程序中所起的作用,进而形成一个虚拟的程序结构,并以此为基础来进行阅读。
1、分层读:高层入手,逐层深入,正确理解程序。
2、写注解:固化、总结、提炼已有的理解成果。
3、先模拟:根据代码顺序跟踪变量,模拟运算。
4、找规律:先模拟几次循环后,找出背后的规律。
5、看功能:从代码结构和运算结果判断程序功能。
6、猜算法:有时不知道算法,通过结构和函数猜一猜。
7、换方法:了解程序本质后,换一个熟悉的方法试试。
对大多数人来说,写程序是令人开心的一件事情,读别人的程序却很痛苦,很恐惧,宁愿自己重写一遍。
其实读到好的程序,就像读一篇美文,令人心旷神怡,豁然开朗,因为这背后是一个人的思维,甚至整个人生。
阅读别人的程序不仅可以巩固自己的知识,启发自己的思维,提升自己的修养,让你收获满满,其实,这也是在学习、在竞赛、在工作中的最重要、最常用的基本功。
如果说写程序是把自己的思维转化为代码,读程序就是把代码转化为你理解的别人的思维。
当你阅读程序时有强烈的代入感,像演员一样,真正进入到编剧的精神世界,面部表情也随之日渐丰富起来。
祝贺你!你通关了!总之,看得多,码得多,拼得多,你就考得多……NOIP2011-1.#include <iostream>#include <cstring> using namespace std; const int SIZE = 100; int main(){int n,i,sum,x,a[SIZE]; cin>>n;memset(a,0,sizeof(a)); for(i=1;i<=n;i++){ cin>>x;a[x]++;}i=0;sum=0;while(sum<(n/2+1)){ i++;sum+=a[i];}cout<<i<<endl; return 0;}输入:4 5 6 6 4 3 3 2 3 2 1一步步模拟,注意输出的是sum超出循环条件时的i值(中位数),而不是sum,也不是a[x]输出:3NOIP2011-2.#include <iostream>using namespace std;int n;void f2(int x,int y);void f1(int x,int y){if(x<n)f2(y,x+y);void f2(int x,int y){cout<<x<<' ';f1(y,x+y);}int main(){cin>>n;f1(0,1);return 0;}输入:30此为简单的递归题,依次输出f2(x,y)中的x值,注意边界条件时f1(x,y)的x>=30咦!这不是隔一个输出一个的Fibonacci吗?输出:1 2 5 13 34NOIP2011-3.#include <iostream>using namespace std;const int V=100;int n,m,ans,e[V][V];bool visited[V];void dfs(int x,intlen){int i;visited[x]= true;if(len>ans)ans=len;for(i=1;i<=n;i++)if( (!visited[i]) &&(e[x][i]!=-1) ) dfs(i,len+e[x][i]);visited[x]=false;}int main(){int i,j,a,b,c;cin>>n>>m;for(i=1;i<=n;i++)for(j=1;j<=m;j++)e[i][j]=-1;for(i=1;i<=m;i++) {cin>>a>>b>>c; e[a][b]=c;e[b][a]=c;}for(i=1;i<=n;i++) visited[i]=false; ans=0;for(i=1;i<=n;i++) dfs(i,0);cout<<ans<<endl; return 0;}输入:4 61 2 102 3 203 4 304 1 401 3 502 4 60一看就知这是深搜算法(DFS),输入是个四个顶点的无向图(邻接矩阵如下):如len>ans,则ans=len,可以说明这是个在图中用DFS找最长的路径的程序。
NOIP 2017全国青少年信息学奥林匹克联赛提高组初赛试题答案一、单项选择题(共 15 题,每题 1.5 分,共计 22.5 分;每题有且仅有一个正确选项)1. 从( )年开始,NOIP 竞赛将不再支持 Pascal 语言。
A. 2020B. 2021C. 2022D. 20232.在 8 位二进制补码中,10101011 表示的数是十进制下的( )。
A. 43B. -85C. -43D.-843.分辨率为 1600x900、16 位色的位图,存储图像信息所需的空间为( )。
A. 2812.5KBB. 4218.75KBC. 4320KBD. 2880KB4. 2017年10月1日是星期日,1949年10月1日是( )。
A. 星期三B. 星期日C. 星期六D. 星期二5. 设 G 是有 n 个结点、m 条边(n ≤m)的连通图,必须删去 G 的( )条边,才能使得 G 变成一棵树。
A.m–n+1B. m-nC. m+n+1D.n–m+16. 若某算法的计算时间表示为递推关系式:T(N)=2T(N/2)+NlogNT(1)=1则该算法的时间复杂度为( )。
A.O(N)B.O(NlogN)C.O(N log2N)D.O(N2)7. 表达式a * (b + c) * d的后缀形式是()。
A. abcd*+*B. abc+*d*C. a*bc+*dD. b+c*a*d8. 由四个不同的点构成的简单无向连通图的个数是( )。
A. 32B. 35C. 38D. 419. 将7个名额分给4个不同的班级,允许有的班级没有名额,有( )种不同的分配方案。
A. 60B. 84C. 96D.12010. 若f[0]=0, f[1]=1, f[n+1]=(f[n]+f[n-1])/2,则随着i的增大,f[i]将接近与( )。
A. 1/2B. 2/3D. 111. 设A和B是两个长为n的有序数组,现在需要将A和B合并成一个排好序的数组,请问任何以元素比较作为基本运算的归并算法最坏情况下至少要做( )次比较。
2011 National English Contest for College students(Level C-Preliminary)Part I Listening Comprehension (30 marks)Section A (5 marks)In this section, you will hear five short conversations. Each conversations will be read only once. At the end of each conversation, there will be a twenty-second pause, read the question and the there choices marked A,B and C ,and decide which is the best answer.Then mark the corresponding letter on the answer sheet with a single line through the centre.1.What does the man want to do?A.Get something to eat now.B.Find a quiet place that shows games.C.Watch the next game with the woman.2.Why does not the man have a MySpace account?A.He is not skilled at using computer.B.All of the instruction are in EnglishC.The woman won not teach him.3.How long does the woman plan to try teleworkingA.For a few days.B.For a few weeks.C.For a few months.4.What does the man hope will happen?A.The price of cell phone novels will go down.B.The novel’s author will writer longer stories.C.The woman will tell him ho the story ends.5.what is the woman going to do next?A.turn on her computer.B.Go for a walk with peter.C.Visit her new neighbors.Section B (10 marks)In this section, you will hear two long conversations. Each conversation will be read only once. At the end each conversation, there will be a one minute pause. During the pause, read the questions, each with three choices marked A, B and C, and decide which is the best answer. Then mark the corresponding letter on the answer sheet with a single line through the centre. Conversation one6.What did Jack do over the summer?A.He studied very hard.B.He took a summer class.C.He visited one of his teachers.7.What does Jack think of Ms Wellington as a teacher?A.Easy-going.B.Tough.C.Interesting.8.Why is Ms Wellington’s class har d?A.Her exams are difficult.B.She does not give students the help they need.C.She makes do lots of work.Conversation two9.Why is Mrs. Griffin going to the city where the hotel is located?A.He is on holiday.B.He’s on a business tripC.He is going to a conference.10. How many times has Mrs. Griffin stayed at the Sunrise Hotel?A. Twice.B. Once.C. Three times.11. Where is Mrs. Griffin form?A. Canada.B. New Zealand.C. Australia.12. What is Mrs. Griffin’s passport number?A.87647489B.87637289C.8763748913. What kind of room does Mrs. Griffin want?A. A single room for two nights.B. A double room for two nights.C. A single room for one night.14. When will Mrs. Griffin arrive at Sunrise Hotel?A. at 9:15 pmB. at 9:35 pmC. at 10:00 pm15. What food will b e put into Mrs. Griffin’s room?A. a sandwich with fries.B. a cheese sandwich.C. a burger with chips.Section C (5Marks)16. What does the Associated Press ask editor and news directors to do?A. vote for the top stories of the year.B. describe the oil spill in the Gulf of MexicoC. writes about the 11 workers killed in the explosion17. Where are the doctors and technology experts from?A. New York.B. LondonC. Tokyo18. For how long does President Obama agree to extend the tax cuts?A. for four yearsB. for three yearsC. for two years.19. How many people in the world don’t have enough to eat,according to the report?A. more than one billion.B. some six hundred million.C. nearly nine hundred million20. What have astronomers recently discovered?A. there are unknown plants in older galaxies.B. there are many galaxies in the universeC. there are a lot more red dwarf in older galaxiesSection D (10 marks)In the section, you will hear a short passage. There are 10 missing words phrases. Fill in the blanks with the exact words or phrases you hear. Remember to write the answer on the answer sheetWhat do you do if you don’t get your first choice university? This ____ faces thousands of British every year. Many such_____ turn to Clearing, a service that helps find university places for students at the last moment. If they don’t have the marks to get into their____, Clearing tells them about places available at other university, though they might have to read a difficult subject.This year has seen a record number of people applying to university. This, combined with the _____________________,an uncertain job market, and budget cuts at university, product even more of a scramble for places than usual. Some sources say six students have applied for each remaining___________________________ placeThe British University Admissions Service, UCAS, says up to a quarter of this year’s university applicants-almost 190000 people-have not been admitted intoa____________________________. That is an increase of over 46000 students from last year.Faced with these figure, some British students might consider an interesting alternative:_____________________________. The University of Nottingham for is offering place at its campuses in Ningbo, near Shanghai, and Kuala Lumpur, Malaysia. Students at these institutions can earn University of Nottingham degrees, according, engineering and English. Similarly, the University of Bolton says it has unlimited places at its campus in the United Arab Emirates.To deal with t hese problems, the UK’s Higher Education Minister, David Willet’s, is encouraging students who have not made the grade to consider alternatives to university, such as_______________________and studying at home.“There are arrange of options available, “he says. “people can reapply next year, so they should consider spending this year in a way that will add positively to their CVs. Getting_____________________or other skills will strengthen their chances next year.” Some commentators say, though that rising university costs, poor long-term_______________________, and a drop in graduate recruitment mean this the worst time to be a university student in the UK.Part Two Vocabulary and Structure (15 marks )There are 15 incomplete sentences in this section. For each blank there are four choices marked A, B, C and D. Choose the one that best completes the sentence. Then mark the corresponding letter on the answer sheet with a single line through the centre.31.After four days of talks, we are glad to announce that the union and management have reached an____A__. The agreement is fair and benefits both sides.A.accordB. accomplishmentC. identityD. undertaking32.As the clerk__B___prepared my milk shake, I wondered how long she had been working there ,mindlessly making ice cream treats in a set order of steps.A.logicallyB. methodicallyC. graphicallyD. synthetically33. As a boy he wanted to be a fireman. As a high school student, he thought he'd like to become a teacher. Now he___C___to be nothing more than a janitor.A.AssumesB. PrescribesC. AspiresD. Presumes34. Regardless of what caused it, I an grateful that have finally reached a point in mylife__B_____I can appreciate my strengths, accept my weaknesses and try to be comfortable with everything in between.A.WhyB. WhereC. WhichD. What35. _C_____information provided by members of the public, the police would have a much move difficult job.A.SupposingB. Provided theC. If it were not forD. On condition that36.Peter Brown was a painstaking writer;_D___, he once spent half a day on the composition of a single sentence.A.On the other handB. NeverthelessC. MoreoverD. For example37.----What an I going to do about a present for Carol?----You_C_____some flowers.A.Might have sent herB. Must have sent herC. Could send herD. Would send her38.Without the air holding in some of the sun's heat, the earth_B_____cold at night, too cold for us to live on.A.Will be freezingB. Would be freezingC. An be frozenD. Would be frozen39.The students in our university each__A____an English dictionary. That is to say, each of the students in our university______an English dictionary.A.Have; hasB. Have; haveC. Has; haveD. Has; has40.Here's your kitchen. I hope you enjoy cooking here. Is there__B____else that you need?A.SomethingB. AnythingC. NothingD. Everything41.David_____C_his business partner over plans to reduce the workforce.A.Came down toB. Broke down toC. Fell out withD. Went along with42.___A___is this piece of equipment to be removed from the building.A.On no accountB. AbsolutelyC. ScarcelyD. Not at all43.Helen' s parents were_C_____that she was still on the job., but she had resigned.A.In doubtB. Of the opinionC. Under the impressionD. With suspicion44.----I don't think I will ever, in my life, win a lottery of five million dollars.----Well, _____D. Anything can happen.A.You made itB. You're kiddingC. What you sayD. You can never tell45.-----How did you find the concert in the Grand Theatre last night?-----____B__ but the conductor was perfect.A.I couldn't agree moreB. I didn't think much of itC. I was crazy about itD. I really likedPart Three Cloze(15 marks )I have been reading a lot on my iPad recently, and I have some (46)____complaints_ (complain) not about the iPad itself but about the state of digital reading generally. Reading is a subtle thing,and its subtleties are artifacts of a venerable medium: words printed in ink on paper. Glass and pixels aren't the same.When I read a physical book, I don't have to look anywhere else to find out how much I've read. The iPad e---reader, iBooks tries to create the (47) illu___remain of a physical book. The pages seem to turn, and I can the edges of those that remain, but it's fake. There are always exactly six unturned pages, no matter (48)____where_ I am in the book.Also, there is a larger problem. Books in their digital format look vastly less "finished", or less genuine than real books. You can vary their font and type size, but this only makes them(49)___resemble_(resemble) word---processed---no matter how (50)wretched___(wretch) or wonderful they are---will never look as good as Robert Hass's poems in the print edition of The Apple Trees at Olema. But your poems can look almost exactly as ugly---as "e---book---like" ---as the Kindle version of that collection.All the e---book I've read have been ugly---books by Chang---rae Lee, Alvin Kernan, and Stieg Larsson---though the texts have been wonderful. I didn't grow up reading texts. I grew up reading books, and this(51)___difference__(differ) is important.When it comes to digital editions, the(52)_assumption____(assume) seems to be that all books(53)are___created_ _(create) equal. However, nothing could be further from the truth. In the mass migration from print to digital, we're seeing a profusion of digital books---many of them out of copyright---that look new and even "HD," but which may well have been supplanted by more accurate editions and better translations. We need a digital readers' guide---a place where readers can find(54)__out__ whether the book they're about to download is the best available edition.(55)Fi__nally___, two related problems. I already have a personal library, but most of the books I've read have come from(56)__lending___(lend) libraries. Barnes & Noble has released ane---reader that allows short---term (57) ____borrowing_(borrow) of some books. The entire idea behind Amazon's Kindle and Apple's iBooks assumes that you cannot read a book unless you own it first and that only you can read it unless you want to give your reading device to someone else. This goes against the social value of reading, the collective knowledge and(58)___collaborative__(collaborate) discourse that comes from access to (59)__shared_or our culture in general.Part Four Reading Comprehension (40 marks).Section A (10 marks ).Questions 61 to 65 are based on the following passage.Not keen on reading? Do you have trouble finding a novel that arouses your interest? Why not follow Ammon Shea's example and start reading a dictionary?Mr Shea owns over 1,000 dictionaries and he reads them for fun. He recently spent a year reading all 20 volumes of the Oxford English Dictionary. The dictionary contains more than20,000 pages and over 59 million words.As he read from A to Z, he noted down interesting words in a ledger. This includes words such as "happify," meaning to make someone happy and "tripudiate", which means to dance, skip or leap for joy. Mr Shea also kept a diary about this experience, which has since become abest---selling book.Why did he do this? He claims it was fun. "I've always enjoyed reading dictionaries . They are far more interesting than people give then credit for," he said.It appears that it was not his goal to sound more intelligent by using longer and more complex words. "I'm not against long, fancy or obscure words, but I'm opposed to using then for their own sake," he said.In fact ,as a result of reading so many new words , Mr Shea often forgot everyday vocabulary. He wrote, "My head was so full of words that I often had trouble forming simple sentences."Mr Shea is not alone in his love of reading dictionaries.Elaine Higgleton, a representative of Collins Cbuild dictionaries, explained that thousands of crossword puzzle and Srabble fans read dictionaries for fun and to improve their games. Ms Higgleton did however note that, "It's probably not the best way to learn English ,and you'd learn more than you need." It is not known how many of the 59 million words Ms Shea remembers, but he has certainly made history with his eccentric hobby.Questions 61 to 65.Decide whether the following statements are True or False.61.Mr Shea has read 1.000 dictionaries.F62.Mr Shea spent one month reading the Oxford English Dictionary.F63.In Mr Shea's opinion,people don't give dictionaries enough credit for being interesting.T64.Mr Shea thinks it is important t be able to use long and complicated words in everyday conversation.F65.Elaine Higgleton thinks that reading a dictionary is the best way to learn English.FSection B (10 marks)Questions 66 to 70are based on the following passage.Surfing is something people often get hooked on after trying it a few times. For many surfers it is much more than a hobby---they would probably agree with the American professional surfer Kelly Slater when he said,"Once you're in, you're in. There's no getting out.""Surfing", of course, refers to riding on ocean waves using a surfboard. Many surfers stand up on their boards, which requires god balance and is therefore difficult for most beginners to learn, but some lie down and "bodyboard"The history of surfing probably began with the Polynesian people of the Pacific Islands. One of the first white people to see anyone surfing was the British explorer Captain Gook, when his ship arrived in Hawaii in 1779. He watched many Hawaiians riding waves on large pieces of wood, and reported that, "Surfing seems to give them a feeling of great pleasure. "When surfing started to become very popular in the United States in the 1950's and 60s, surfers used large wooden boards (often more than three metres long) that were quite heavy. Boards today are shorter and also much lighter, because they are made of artificial materials instead of wood. For anyone who wants to try surfing. The only essentials are waves and a board. There are a few other things, however, that most surfers find important; a cord t attach one of their ankles to the board and therefore stop it from being carried a long way away when they fall off'; wax, which they put on the surface of the board to help their feet stick to it; and a wetsuit to help them keep warm in cold water. The south---west of English is an example of a place where surfers usually need wetsuits, even in summer.Surfing has been a professional sport for many yeara and the very best surfers are able to makea living from it. Most of the best professional surfers in the last 30 years, both men and women, have been American or Australian, but surfers from Brazil, Peru and South Africa have also won important competitions.Questions 66 to 70Answer the following questions with the information given in the assage in a maximum of 10 words for each question.66.Why do most beginners find it difficult t stand up on a surfboard?Because standing up on their boards requires god balance .67.In what part of the world did surfing probably begin?The Polynesian people of the Pacific Islands.68.When did surfing start to become very popular in the United States?In the 1950's and 60s69.What do surfers use wax for?To help their feet stick to the board70.According to the passage, in what part of the world do surfers usually need wetsuits?In the southwest of EnglandSection C (10 marks)Questions 71 to 75 are based on the following passage.The latest human development report from the United Nations Development Programmed (UNDP) contains some good news, but also a very serious warning about the threat posed y climate change.The report, published annually since 1990, seeks to asses “human development” around the world, and calculates a “Human Development Index (HDI) for 169 counties. The HDI is based on average income, life expectancy and level of education in a country. Not surprisingly, rich counties tend to have higher HDIs than poor counties, but there are interesting variations in human development among countries with similar levels of economic development, because some have better health and education systems than others.According to the 2010 report, the county with the highest level of human development is Norway, followed by Australia, New Zealand, the United States and Ireland. Most of the lowestHDIs belong to counties in sub-Saharan Africa.Almost all counties around the worlds have higher HDIs now than in 1990, despite the fact that since the 2008 financial crisis, the total number of people living in extreme poverty has increased. The report concludes that most people are healthier, live longer, are better educated and have access to more goods and services. Even in countries with severe economic problems, people’s level of health and education as generally improved. Although sub-Saharan African countries are at the bottom of the pile in terms of human development, some of them have made significant progress since 1990. The report is critical, however, of the fact economic inequality has increased significantly in the last twenty years, both within and between countries.The greatest threat to improving HDIs in the future, according to the report, is climate change. Economic growth increases average incomes in a country through increasing production and consumption. However , if this leads to greater emissions of greenhouse gases, as has always been the case in the past, global warning will probably accelerate, and cause severe environmental problem s in some parts of the world hat will threaten the livelihoods of huge numbers f people. The progress of the last twenty years, therefore, might not be sustainable.The only solution, according to the report, I to break the link between economic growth and greenhouse gas emissions-which, needless to say, is easier, said than done.Questions 71 to 75Complete the following sentences with information given in the passage in a maximum of 10 words for each blank.71. The concept of “human development” is based on the following three factors: _____ average income, ____ life expectancy _______and___ level of education72. Some countries with similar levels of economic development have quite different HDIs because they have_______ better health and education systems than others.______.73._______________ The financial crisis,__has caused the number of people living in extreme poverty to increase since 2008.74. The report says that _______ climate change______ is the greatest threat to increasing HDIs in the future.75. The report says the link between_____ economic growth _____ and ________ greenhouse gasemissions-____needs to be broken.Section D (10 marks)Questions 76 to 80 are based on the following passageIt is natural for young people to be critical of their parents at times and to blame them for most of the misunderstanding between them. They have always complained, more or less justly, that their parents are out of touch with modern ways; that they are possessive and dominant; that they do not trust their children to deal with crises: that they talk too much about certain problems-and that they have no sense o humor, at least parent-child relationships.I think it is true that parents often underestimate their teenage children and also forget how they felt themselves when were young.Young people often irritate their parents with their choices in clothes, hairstyles, entertainers and music. This is not their motive. They feel cut off from the adult world into which they have not yet been accepted, so they create a culture and society and their own. Then, if it turns out that their music, entertainers, vocabulary, clothes or hairstyles irritate their parents, this gives them additional enjoyment. They feel they are superior, at least in a small way, and that they are leaders in style and taste.Sometimes teenagers are resistant and proud because they do not want their parents to approve of what they do. If they did approve, it looks as if the teenager is betraying his own age group. All this is assuming that the teenager is the underdog: he can not win but at least he can keep his honor. This is a passive way of looking at things. It is natural enough after years of childhood, when children were completely under their parent’s control, but it ignores the fact that when they become teenagers, children are beginning to be responsible for themselves.If you plan to control your life, co-operation should be a part of that plan. You can charm other people, especially your parents, into doing things the way you want. You can also impress people with your of responsibility and your initiative, so that they will give you the authority to do what you want to do.Questions 76 to 78Choose the best answer according to the passage.76 the first paragraph is mainly about______A_______.A teenagers’ criticism of their parentsB misunderstanding between teenagers and their parentsC the dominance of parents over their childrenD teenagers’ ability to deal with crises77 teenagers have strange clothes and hairstyles because they____B_______A have a strong desire to be leaders in style and tasteB want to prove their existence by creating a culture of their ownC have no other way to enjoy themselvesD want to irritate their parent78 teenagers do not want their parents to approve of what they do because they_____D__________.A have already been accepted into adult worldB feel that they are superior to adult worldC want to win adults over to their cultureD don’t want to appear to be disloyal to their own age groupQuestion 79 to 80Translate the sentences in the passage into Chinese79 I think it is true that parents often underestimate their teenage children and also forget how they felt themselves when were youn我认为父母经常低估他们十几岁的孩子,同时也忘记他们年轻时候的感受。
NOIP 提高组初赛历年试题及答案阅读题篇程序写果(共 4 ,每 8 分,共 32 分)程序的最好方法并非是依次从到尾。
程序不像迷,我无法从末尾几找到答案,也不像一本引人入的籍,只需直接翻到褶最多的那几,我就能找到最精彩的片断。
因此我在程序,最好逐一考察研究每一段代,搞清楚每一段代的来去脉,理解每一段代在程序中所起的作用,而形成一个虚的程序构,并以此基来行。
1、分:高入手,逐深入,正确理解程序。
2、写注解:固化、、提已有的理解成果。
3、先模:根据代序跟踪量,模运算。
4、找律:先模几次循后,找出背后的律。
5、看功能:从代构和运算果判断程序功能。
6、猜算法:有不知道算法,通构和函数猜一猜。
7、方法:了解程序本后,一个熟悉的方法。
大多数人来,写程序是令人开心的一件事情,人的程序却很痛苦,很恐惧,宁愿自己重写一遍。
其到好的程序,就像一篇美文,令人心神怡,豁然开朗,因背后是一个人的思,甚至整个人生。
人的程序不可以巩固自己的知,启自己的思,提升自己的修养,你收,其,也是在学、在、在工作中的最重要、最常用的基本功。
如果写程序是把自己的思化代,程序就是把代化你理解的人的思。
当你程序有烈的代入感,像演一,真正入到的精神世界,面部表情也随之日丰富起来。
祝你!你通关了!之,看得多,得多,拼得多,你就考得多⋯⋯NOIP2011-1 .#include <iostream>#include <cstring>using namespace std;const int SIZE = 100;int main(){int n,i,sum,x,a[SIZE];cin>>n;memset(a,0,sizeof(a));for(i=1;i<=n;i++){cin>>x;a[x]++;}i=0;sum=0;while(sum<(n/2+1)){i++;sum+=a[i];}cout<<i<<endl;return 0;}输入:114 5 6 6 4 3 3 2 3 2 1一步步模拟,注意输出的是sum超出循环条件时的i 值(中位数),而不是sum ,也不是a[x]输出: 3NOIP2011-2 .#include <iostream> using namespace std; int n;void f2(int x,int y); void f1(int x,int y){if(x<n)f2(y,x+y);}void f2(int x,int y){cout<<x<<' ';f1(y,x+y);}int main(){cin>>n;f1(0,1);return 0;}输入: 30此为简单的递归题,依次输出f2(x,y)中的x值,注意边界条件时f1(x,y)的x>=30咦!这不是隔一个输出一个的Fibonacci吗?输出: 1 2 5 13 34NOIP2011-3 .#include <iostream>using namespace std; const int V=100;int n,m,ans,e[V][V];bool visited[V];void dfs(int x,intlen){int i;visited[x]= true;if(len>ans)ans=len;for(i=1;i<=n;i++)if( (!visited[i]) &&(e[x][i]!=-1) ) dfs(i,len+e[x][i]);visited[x]=false;}int main(){int i,j,a,b,c;cin>>n>>m;for(i=1;i<=n;i++)for(j=1;j<=m;j++)e[i][j]=-1;for(i=1;i<=m;i++){cin>>a>>b>>c;e[a][b]=c;e[b][a]=c;}for(i=1;i<=n;i++)visited[i]=false;ans=0;for(i=1;i<=n;i++)dfs(i,0);cout<<ans<<endl;return 0;}输入:4 61 2 102 3 203 4 304 1 401 3 502 4 60一看就知这是深搜算法(DFS ),输入是个四个顶点的无向图(邻接矩阵如下):如len>ans,则 ans=len,可以说明这是个在图中用DFS找最长的路径的程序。
第十届全国青少年信息学奥林匹克联赛初赛试题(提高组 C 语言二小时完成)●●全部试题答案均要求写在答卷纸上,写在试卷纸上一律无效●●一、单项选择题(共10题,每题1.5分,共计15分。
每题有且仅有一个正确答案.)。
1.设全集I = {a, b, c, d, e, f, g},集合A = {a, b, c},B = {b, d, e},C = {e, f, g},那么集合BA⋂C-为()。
⋃(B(~))A. {a, b, c, d}B. {a, b, d, e}C. {b, d, e}D. {b, c, d, e}E. {d, f, g}2.由3个a,5个b和2个c构成的所有字符串中,包含子串“abc”的共有()个。
A. 40320B. 39600C. 840D. 780E. 603.某个车站呈狭长形,宽度只能容下一台车,并且只有一个出入口。
已知某时刻该车站状态为空,从这一时刻开始的出入记录为:“进,出,进,进,出,进,进,进,出,出,进,出”。
假设车辆入站的顺序为1,2,3,……,则车辆出站的顺序为()。
A. 1, 2, 3, 4, 5B. 1, 2, 4, 5, 7C. 1, 3, 5, 4, 6D. 1, 3, 5, 6, 7E. 1, 3, 6, 5, 74.满二叉树的叶结点个数为N,则它的结点总数为()。
A. NB. 2 * NC. 2 * N – 1D. 2 * N + 1E. 2N– 15.二叉树T,已知其前序遍历序列为1 2 4 3 5 7 6,中序遍历序列为4 2 1 5 7 3 6,则其后序遍历序列为()。
A. 4 2 5 7 6 3 1B. 4 2 7 5 6 3 1C. 4 2 7 5 3 6 1D. 4 7 2 3 5 6 1E. 4 5 2 6 3 7 16.十进制数100.625等值于二进制数()。
A. 1001100.101B. 1100100.101C. 1100100.011D. 1001100.11E. 1001100.017.下面哪个部件对于个人桌面电脑的正常运行不是必需的()。
第二十届全国青少年信息学奥林匹克联赛初赛普及组C语言试题竞赛时间:2014年10月12日14:30~16:30选手注意:试题纸共有8页,答题纸共有2页,满分100分。
请在答题纸上作答,写在试题纸上的一律无效。
不得使用任何电子设备(如计算器、手机、电子词典等)或查阅任何书籍资料。
一、单项选择题(共20题,每题1.5分,共计30分;每题有且仅有一个正确选项)1. 以下哪个是面向对象的高级语言()。
A. 汇编语言B. C++C. FortranD. Basic2. 1TB代表的字节数量是()。
A. 2的10次方B. 2的20次方C. 2的30次方D. 2的40次方3. 二进制数00100100和00010101的和是()。
A. 00101000B. 001010100C. 01000101D. 001110014. 以下哪一种设备属于输出设备()。
A. 扫描仪B. 键盘C. 鼠标D. 打印机5. 下列对操作系统功能的描述最为完整的是()。
A. 负责外设与主机之间的信息交换B. 负责诊断机器的故障C. 控制和管理计算机系统的各种硬件和软件资源的使用D. 将源程序编译成目标程序6. CPU、存储器、I/O设备是通过()连接起来的。
A. 接口B. 总线C. 控制线D. 系统文件7. 断电后会丢失数据的存储器是()。
A.RAMB. ROMC. 硬盘D. 光盘8. 以下哪一种是属于电子邮件收发的协议()。
A. SMTPB. UDPC. P2PD. FTP9. 下列选项中不属于图像格式的是()。
A. JPEG格式B. TXT格式C. GIF格式D. PNG格式10. 链表不具有的特点是()。
A. 不必事先估计存储空间B. 可随机访问任一元素C. 插入删除不需要移动元素D. 所需空间与线性表长度成正比11. 下列各无符号十进制整数中,能用八位二进制表示的数中最大的是()。
A. 296B. 133C. 256D. 19912. 下列几个32位IP地址中,书写错误的是()。
NOIP2014提高组第一试题解【第一题】石头剪刀布rps【题目大意】a和b石头剪刀布游戏,每个人一共有五种方式,相互之间的胜负关系给出,a和b出拳的方式是循环的,赢者得一份,其余不得分。
问n轮以后a和b的得分。
纯粹的模拟题,把胜负关系打表或者case出来即可。
1.#include <iostream>2.#include <cstdio>3.#include <cstdlib>4.ing namespace std;6.const int win[5][5] = {7. 0,0,1,1,0,8. 1,0,0,1,0,9. 0,1,0,0,1,10. 0,0,1,0,1,11. 1,1,0,0,012. };13.int a[205], b[205];14.int main()15.{16. freopen("rps.in","r",stdin);17. freopen("rps.out","w",stdout);18.int n, na, nb;19. cin>>n>>na>>nb;20.for (int i = 0; i < na; ++i) cin>> a[i];21.for (int i = 0; i < nb; ++i) cin>> b[i];22.int i = 0, j = 0;23.int ascore = 0, bscore = 0;24.while (n) {25. ascore += win[a[i]][b[j]];26. bscore += win[b[j]][a[i]];27. i = (i + 1) % na;28. j = (j + 1) % nb;29. n --;30. }31. cout << ascore << " "<< bscore<<endl;32.return 0;33.}【第二题】联合权值link给出n个点,n-1条件的图,每个点均有点权值w[i],如果i和j距离为2,那么他们会产生w[i] * w[j]的值,求问产生值中的最大值和产生值得总和。
Noip2014初赛提高组试题及答案(完整版)提高组C语言试题一、单项选择题(每题1.5分,共22.5分)。
1. 以下哪个是面向对象的高级语言( ).A. 汇编语言B. C++C. FORTRAND. Basic2. 1TB代表的字节数量是( ).A. 2的10次方B. 2的20次方C. 2的30次方D. 2的40次方3. 二进制数00100100和00010101的和是( ).A. 00101000B. 001010100C. 01000101D. 001110014. TCP协议属于哪一层协议( ).A. 应用层B. 传输层C. 网络层D. 数据链路层5. 下列几个32位IP地址中,书写错误的是( ).A. 162.105.128.27B. 192.168.0.1C. 256.256.129.1D. 10.0.0.16. 在无向图中,所有定点的度数之和是边数的( )倍.A. 0.5B. 1C. 2D. 47. 对长度位n的有序单链表,若检索每个元素的概率相等,则顺序检索到表中任一元素的平均检索长度为( ).A. n/2B. (n+1)/2C. (n-1)/2D. n/48. 编译器的主要功能是( ).A. 将一种高级语言翻译成另一种高级语言B. 将源程序翻译成指令C. 将低级语言翻译成高级语言D. 将源程序重新组合9. 二进制数111.101所对应的十进制数是( ).A. 5.625B. 5.5C. 6.125D. 7.62510. 若有变量int a, float x, y, 且a=7, x=2.5, y=4.7, 则表达式x+a%3*(int)(x+y)%2/4的值大约是( ).A. 2.500000B. 2.750000C. 3.500000D. 0.00000011. 有以下结构体说明和变量定义,如图所示,指针p、q、r分别指向一个链表中的三个续结点。
struct node {int data;struct node *next;↑p ↑q ↑r} *p,*q,*r;现要将q和r所指结点的先后位置交换,同时要保持链表的连续,以下程序段中错误的是( ).A. q->next = r->next; p-> next = r; r->next = q;B. p->next = r; q->next = r->next; r->next = q;C. q->next = r->next; r->next = q; p->next = r;D. r->next = q; q->next = r->next; p->next = r;12. 同时查找2n 个数中的最大值和最小值,最少比较次数为( ).A. 3(n-2)/2B. 4n-2C. 3n-2D. 2n-213. 设G是有6个结点的完全图,要得到一颗生成树,需要从G中删去( )条边.A. 6B. 9C. 10D. 1514. 以下时间复杂度不是O(n2)的排序方法是( ).A. 插入排序B. 归并排序C. 冒泡排序D. 选择排序15. 以下程序实现了找第二小元素的算法。
输入时n个不等的数构成的数组S,输出S中第二小的数SecondMin。
在最坏的情况下,该算法需要做( )次比较。
if (S[1] < S[2]) {FirstMin = S[1];SecondMin = S[2];} else {FirstMin = S[2];SecondMin = S[1];}for (i = 3; i <=n; i++)if (S[1] < SecondMin)if (S[1] < FirstMin){SecondMin = FirstMin;FirstMin = S[1];} else {SecondMin = S[1];}A. 2nB. n-1C. 2n-3D. 2n-2二、不定项选择题(每题1.5分,共7.5分)。
1. 若逻辑变量A、C为真,B、D为假,以下逻辑运算表达式真的有( ).A. (B∨C∨D)∨D∧AB. ((- A∧B)∨C)∧BC. (A∧B)∨(C∧D∨-A)D. A∧(D∨-C)∧B2. 下列( )软件属于操作系统软件。
A. Microsoft WordB. Windows XPC. AndroidD. Mac OS XE. Oracle3. 在NOI比赛中,对于程序设计题,选手提交的答案不得包含下列哪些内容( ).A. 试图访问网络B. 打开或创建题目规定的输入/输出文件之外的其他文件C. 运行其他程序D. 改变文件系统的访问权限E. 读写文件系统的管理信息4. 以下哪些结构可以用来存储图( ).A. 邻接矩阵B. 栈C. 邻接表D. 二叉树5. 下列各无符号十进制整数中,能用八位二进制表示的数有( ).A. 296B. 133C. 256D. 199三、问题求解。
1. 有数字1,1,2,4,8,8所组成的不同的四位数的个数是_____.2. 如图所示,图中每条边上的数字表示该边的长度,则从A到E的最短距离是_____.四、阅读程序写结果(共4题,每题8分,共32分)。
1. #include <stdio.h>int main() {int a,b,I,tot,c1,c2;scanf(“%d%d”, &a, &d);tot = 0;for (i=a; i<=b; i++){c1=i/10;c2=i%10;if ((c1+c2)%3 ==0)tot++;}Printf(“%d\n",tot);Return 0;}输入:7 31输出:_________2. #include <stdio.h>Int fun(int n, int minNum, int maxNum){ int tot, i;if (n==0)retuen 1;tot=0;for(i=minNum; i<=maxNum; i++)tot+=fun(n-1, i=1, maxNum);return tot;}int mian(){int n, m;Scanf(“%d%d”, &n,&m);printf(“%d\n”, fum(m,1,n));return 0;}输入:6 3输出:________3.#include <stdio.h>#include <string.h>const int SIZE=100;const int LENGTH=25;// strcmp(a,b) <0:a的字典序小于b// strcmp(a,b) =1:a和b一样// strcmp(a,b) >0:a的字典序大于bint main()char dict[SIZE][LENGTH+1];int rank[SIZE];int ind[SIZE];int i,j,n,tmp;scanf(“%d”,&n);for (i=1;i<=n;i++){rank [i]=iind[i]=i;scanf(“%s”, dict[i]);}for(i=1;i<n;i++)for(j=1;j<=n-i;j++)if(strcmp(dict[ind[j]],dict[ind[j+1]])>0) {tmp=ind[j];ind[j]=ind[j+1];ind[j+1]=tmp;for(i=1;i<=n;i++)rank[ind[i]]=i;for(i=1:i<=n;i++)ptintf(%d”,rank[i]);printf(“\n”);return 0;}输入:7aaaababbbaaaaaacccaa输出:______4.#niclude <stdio.h>const int SIZE=100;int alive[SIZE];int n;int next(int num){do{num++;if(num>n)num=1;}while (alive[num]==0);return num;int main(){int m,i,j,num;scanf(“%d%d”,&n,&m);for(i=1;i<=n;i++)alive[i]=1;num=1;for(i=1;i<=n;j++){ for(j+1;j<=m;j++)num=next(num);printf(“%d”,num);alive[num]=0;if(i<n)num=next(num);}printf(\n);return 0;}输入:11 3输出:_________五、完善程序1.(双栈模拟数组)只使用两个栈结构stack1和stack2,模拟对数组的随机读取。
作为栈结构,stack1和stack2只能访问栈顶(最后一个有效元素)。
栈顶指针top1和top2均指向栈顶元素的下一个位置。
输入第一行包含的两个整数,分别是数组长度n和访问次数m,中间用单个空格隔开。
第二行包含n个整数,一次歌出数组各项(数组下标从0到a-1)。
第三行包含m个整数,需要访问的数组下标。
对于每次访问,输出对应的数组元素。
#include <stdio.h>consr int SIZE=100;int stack1[SIZE],stack2[SIZE];int top1,top2;int n,m,i,j;void clearStack(){int I;for(i=top1;i<SIZE;i++)stack[i]=0;for(i=top2;i<SIZE;i++)stack[i]=0;}int main()scanf(%d,%d”,&n,&m);for(i=0i<n;i++)scanf(“%d”,&stack1[i]);top1=_____(1)______;top2=_______(2)____;for(j=0j<m;j++){scanf(“%d”,&i);while(i<top1-1){top1- -;(3) ;top2++;}while(i>top1-1){top2- -;(4) ;top1++;}clearstack();printf(“%d\n”,stack1[ (5) ]);}return 0;}2.(最大矩阵和)给出M行N列的整数矩阵,就最大的子矩阵和(子矩阵不能为空)。
输入第一行包含两个整数M和N,即矩阵的行数和列数。