C语言编程题目1

2019-04-22 14:38

(1000).

Description

Calculate a+b

Input

Two integer a,b (0<=a,b<=10)

Output

Output a+b

Sample Input

1 2

Sample Output

3

(1001)

Description

There is a famous railway station in PopPush City. Country there is

incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It was

possible to establish only a surface track. Moreover, it turned out that the station could be only a dead-end one (see picture) and due to lack of available space it could have only one track.

The local tradition is that every train arriving from the direction A continues in the direction B with coaches

reorganized in some way. Assume that the train arriving from the direction A has N <= 1000 coaches numbered in increasing order 1, 2, ..., N. The chief for train reorganizations must know whether it is possible to marshal coaches continuing in the direction B so that their order will be a1, a2, ..., aN. Help him and write a program that decides whether it is possible to get the required order of coaches. You can assume that single coaches can be disconnected from the train before they enter the station and that they can move themselves until they are on the track in the direction B. You can also suppose that at any time there can be located as many coaches as necessary in the station. But once a coach has entered the station it cannot return to the track in the direction A and also once it has left the station in the direction B it cannot return back to the station.

Input

The input consists of blocks of lines. Each block except the last describes one train and possibly more requirements for its reorganization. In the first line of the block there is the integer N described above. In each of the next lines of the block there is a permutation of 1, 2, ..., N. The last line of the block contains just 0.

The last block consists of just one line containing 0.

Output

The output contains the lines corresponding to the lines with

permutations in the input. A line of the output contains Yes if it is possible to marshal the coaches in the order

required on the corresponding line of the input. Otherwise it contains No. In addition, there is one empty line after the lines corresponding to one block of the input. There is no line in the output corresponding to the last ``null'' block of the input.

Sample Input

5

1 2 3 4 5 5 4 1 2 3 0 6

6 5 4 3 2 1 0 0

Sample Output

Yes

No Yes

(1002)

Description

给你一组数(未排序),请你设计一个程序:求出里面个数最多的数。并输出这个数的长度。

例如:给你的数是:1、 2、 3、 3、 4、 4、 5、 5、 5 、6, 其中只有6组数:1, 2, 3-3, 4-4, 5-5-5 and 6.

最长的是5那组,长度为3。所以输出3。

Input

第一行为整数t((1 ≤ t ≤ 10)),表示有n组测试数据。

每组测试数据包括两行,第一行位数组的长度n (1 ≤ n ≤ 10000)。第二行为n个整数,所有整数Mi的范围都是(1 ≤ Mi ≤ 2^32)

Output

对应每组数据,输出个数最多的数的长度。

Sample Input

1 10

1 2 3 3 4 4 5 5 5 6

Sample Output

3

1003

我们知道,高中会考是按等级来的。 90~100为A; 80~89为B; 70~79为C; 60~69为D; 0~59为E。

编写一个程序,对输入的一个百分制的成绩t,将其转换成对应的等级。 Input

输入数据有多组,每组占一行,由一个整数组成. Output

对于每组输入数据,输出一行。如果输入数据不在0~100范围内,请输出一行:“Score is error!”。 Sample Input 56 67 100 123

Sample Output

E D A

Score is error! 答案

#include int main() { int score; while(scanf(\=EOF) {

if(score>=90&&score<=100) printf(\ else if(score>=80&&score<90) printf(\ else if(score>=70&&score<80) printf(\ else if(score>=60&&score<70) printf(\ else if(score>=0&&score<60) printf(\ else printf(\error!\\n\ } return 0; }

1005

已知元素从小到大排列的两个数组x[]和y[],请写出一个程序算出两个数组彼此之间差的绝对值中最小的一个,这叫做数组的距离。 Input

第一行为两个整数m, n(1≤m, n≤1000),分别代表数组f[], g[]的长度。 第二行有m个元素,为数组f[]。 第三行有n个元素,为数组g[]。 Output

数组的最短距离 Sample Input 5 5

1 2 3 4 5 6 7 8 9 10 Sample Output

1

答案:

#include #include int main() { int

m,n,f[1500],g[1500],min,i,j; scanf(\ for(i=0;i

if(min>abs(f[i]-g[j])) min=abs(f[i]-g[j]); printf(\ return 0; } 1035

密码是我们生活中非常重要的东东,我们的那么一点不能说的秘密就全靠它了。哇哈哈.

接下来渊子要在密码之上再加一套密码,虽然简单但也安全。

假设渊子原来一个BBS上的密码为zvbo941987,为了方便记忆,他通过一种算法把这个密码变换成

YUANzi1987,这个密码是他的名字和出生年份,怎么忘都忘不了,而且可以明目张胆地放在显眼的地方而不被别人知道真正的密码。

他是这么变换的,大家都知道手机上的字母: 1--1, abc--2, def--3, ghi--4, jkl--5, mno--6, pqrs--7, tuv--8 wxyz--9, 0--0,就这么简单,渊子把密码中出现的小写字母都变成对应的数字,数字和其他的符号都不做变换,声明:密码中没有空格,而密码中出现的大写字母则边成小写之后往后移一位,如:X,先边成小写,再往后移一位,不就是y了嘛,简单吧。记住,z往后移是a哦。 Input

输入包括多个测试数据。输入是一个明文,密码长度不超过100个字符,输入直到文件结尾。

Output

输出渊子真正的密文。

Sample Input

YUANzi1987

Sample Output

zvbo941987 1036

我们在“渊子数”的题目中已经了解了渊子是个什么样的人了,他在大一的时候参加过工商学院的“英语聚乐部”。告诉你个秘密,这个俱乐部是个好地方,不但活动精彩而且有MM。 这不,英语俱乐部举办了一个叫做“英文金曲大赛”的节目。这个节目有好多

人参加,这不,成绩出来了,渊子当是很勇敢,自告奋勇接下了算出大家的总得分的任务。

当时有7个评委,每个评委都要给选手打分,现在要求去掉一个最高分和去掉一个最低分,再算出平均分。结果精确到小数点后两位。

Input

测试数据包括多个实例。

每组数据包括7个实数,代表评委们对该选手的评分。紧接着是选手的名字,名字的长度不超过30个字符。 输入直到文件结束。

Output

算出每位选手名字和最终得分,结果保留两位有效数字。

Sample Input

10 10 10 10 10 10 9 xiaoyuanwang 0 0 0 0 0 0 0 beast

Sample Output

xiaoyuanwang 10.00 beast 0.00 1037

Jesse是个数学迷,他最喜欢研究“哥德巴赫猜想”,因此他的计算机密码也都采用素数。

但一直用同一个密码是不安全的,所以他要经常更换他的密码。但他只允许自己的密码中出现某些数字,且密码的每一位都不相同。比如1 2 4,则有6种情况124 142 214 241 412 421。其中241 和 421为素数。为了获得他

的密码(他的机器上存放了第4届舜禹杯大学生程序设计竞赛的题目!),需要生成一个字典来帮助我们破解。 请你来编写一个程序帮助我们(因为众所周知的原因我们迫切需要获得这些题目)。

Input

1 Line 1:密码的位数n (1 ≤ n ≤ 9)。

2 Line 2:1->n个不重复的整数序列 (1 ≤ x[i] ≤ 9). 输入0结束。

Output

按从小到大顺序输出所有的结果。 如果一个结果也没有,输出“NONE”。 每组数据后面跟随一个空行。

Sample Input

3

1 2 4 0

Sample Output

241 421 1038

居然有假币!!!

事情是这样的,现在猪肉涨了,但是农民的工资却不见涨啊,没钱怎么买猪肉啊。渊子这就去买猪肉,结果找来的零钱中有假币!!!可惜渊子一不小心把它混进了一堆真币里面去


C语言编程题目1.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:IMC试题及答案3

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: