ImageVerifierCode 换一换
格式:DOCX , 页数:73 ,大小:32.61KB ,
资源ID:18683310      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/18683310.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C语言题目及答案Word下载.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C语言题目及答案Word下载.docx

1、32.多项式求和33.人口问题34.数字菱形Climb the Taishan Mountain(II)Time Limit:1000MS Memory Limit:65536KTotal Submit:753 Accepted:495DescriptionLabor day is coming.Since the holiday is long,Many students are planning to have a tour. The Taishan Mountain is very beautiful, so WangPeng and his classmates want to cli

2、mb the Taishan Mountain. Mountaineering sports is WangPengs avocation, so he is very excited. Suddenly, a very amusing idea comes to him. The Taishan Mountain has many stairs, and he can climb the mountain one step by 2 stairs or by 1 stairs. How many ways does he have to climb the mountain? For exa

3、mple, the stairs is 2, he has 2 ways.The first one is the first step by 1 stair, and the next step by 1 stair.And the second way is only one step by 2 stairs. InputThe input is including many test cases. Every line is one test case with a integer number N(N=40). N is the stairs of the Taishan Mounta

4、in. OutputYou should output how many ways WangPeng can climb the mountain, each case output a line.Sample Input123Sample Output#includeint main() int n,i,j,a41; while(scanf(%d,&n)!=EOF) a0=1; a1=2; for(i=2;i40;i+) ai=ai-1+ai-2; printf(%dn,an-1);Peach689 Accepted:Almost all young man know Monkey Sun

5、whose name is Sun Wukong. One day he steals many peaches from the kingdom of heaven. First day, he ate a half of the peaches, then ate another one of the left peaches.The next day, he ate a half of the left peaches, then another one.Until the n-th day ,before he ate he found only one peach. Please h

6、elp Sun Wukong to calculate how many peaches he took from the kingdom of heaven.The input file contains one or more test cases, each line is the days N(1 n 30).For each test case, output a line indicating the number of peaches Monkey Sun had the first day.422 int n,t,i,s; t=1; s=0; for(i=0;n-1; s=(t

7、+1)*2; t=s;,t);循环练习a+bC语言初学者百题大战之二十二3739 Accepted:2513终于到循环结构了。现在开始你可以做很多事情了。 现在我们开始第一个循环题目计算a+b.很多的题目测试数据会有很多组的,一般我们的在线系统没写具体要求的时候,输入是以EOF为结束的。这题的基本框架如下: int a,b;%d%da,&b)!=EOF) /特别注意这行的写法 ./求和 ./输出scanf函数是有返回值的,如果从键盘上成功读入一个数,那么返回值就是1,如果成功读入2个,则返回2。如果处理到文件末尾,则返回EOF特别注意:题目的要求实际上是指每组数据输入结束后,马上输出这组的结果

8、,而不是等所有数据输完后才输出结果输入为多组测试数据。每组一行,每行输入2个整数a和b对于每组测试数据,输出一行,输出a+b的值,直到文件末尾2 34 57 85915,a+b);新郎新娘1659 Accepted:1069Labor day is long, and many young people will have their wedding between 1st,May and 7th, May. Yesterday, three young couples took photos beside the West Lake. The three bridegroom is A, B

9、, C, and the three bride is X, Y, Z. Mary asked them to know who are the couples.She asked three of them. A said he will marry to X. X said that her young man is C. And C said he will marry to Z. Mary know what all they said is wrong.Since you are very smart, she asks you to help her to find who is

10、the bride of A, who is the bride of B, and who is the bride of C?No Input.Output three lines. the first line is the bride of A, the second line is the bride of B, the third line is the bride of C.XYZ(May no the sequence) int x,y,z; for(x=1;x=3;x+) for(y=1;yy+) z=6-x-y; if(x!=y&x!=z&y!=3&z!=1) if(x=1

11、)Xn); if(y=1)Yn if(z=1)Zn if(x=2) if(y=2) if(z=2) if(x=3) if(y=3) if(z=3)最大公约数和最小公倍数2745 Accepted:1398Given 2 positive integer x(1=x=1000) and y(1=yy) t=x; x=y; y=t; for(i=x;i0;i-) if(x%i=0&y%i=0) a=i; break; b=(x*y)/a;%d %dn,a,b);查找某一个数1118 Accepted:551输入一个从小到大排列的有序数列(长度小于100),在此数列中查找某一个数x,若找到,输出相应

12、下标,否则,输出”Not Found.多组测试数据,先输入要查找的数x和n, 再输入n个有序数。输出x所在位置下标或Not Found2 8 -2 2 3 8 9 20 25 675 7 -2 2 3 8 9 20 25 Not Found int n,x,a100,i,s,j;x)! scanf(n);n;ai); s=-1; for(j=0;jj+) if(aj=x),j); s=j; if(s=-1)Not Foundn偶数排序630 Accepted:433输入一个正整数N和N个整数,将它们中的偶数按从大到小的顺序进行排序后输出。多组测试数据,每组输入一个正整数N(1N100)和N个整

13、数,用空格分隔。将这N个数中的偶数按从大到小的顺序输出10 8 4 14 2 11 30 40 500 17 1008 80 200 99 -12 34 55 88 11500 100 40 30 14 8 4 2200 88 80 34 -12 int n,m,j,q,p,i,b10000,a10000,r,e;bi); e=0; for(r=0;rr+) if(br%2=0) ae=br; e=e+1; m=a0;e-1; for(q=j+1;qaj) m=aq; aq=aj; aj=m; for(p=0;pp+)%d ,ap);,ae-1);N个数从大到小排序1787 Accepted:

14、1254输入一个正整数N和N个整数,将它们按从大到小的顺序进行排序后输出。将这N个数按从大到小的顺序重新输出。10 -4 5 12 88 23 -9 2 0 8 105 12 3 4 9 -2 88 23 12 10 8 5 2 0 -4 -912 9 4 3 -2 int n,m,j,q,p,i,a10000;N个数从小到大排序2443 Accepted:1289输入一个正整数N和N个整数,将它们按从小到大的顺序进行排序后输出。将这N个数按从小到大的顺序重新输出 5 12 3 4 9 -2-9 -4 0 2 5 8 10 12 23 88-2 3 4 9 12 if(aq逆序输出数列345

15、Accepted:282输入一个正整数n(n1j-),aj);,a0);逆序数544 Accepted:365输入一个任意整数(int型),输出其位数并逆序输出该数。多组测试数据,每组输入一个任意整数(int型)输出其位数及逆序数12345-12354321 5-321 3 int n,w,a10000,j,i; w=n; if(n0) n=-n;100000; ai=n%10; if(n=0) n=n/10; if(w-i; %dn,i);计算高度519 Accepted:321一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在第n次落地时,共经过多少米?第n次反弹多高?(输出保留1位小数)多组测试数据,每组输入

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1