C语言:基本控制结构
计算题
Time Limit: 1000MS Memory limit: 65536K
题目描述
一个简单的计算,你需要计算f(m,n),其定义如下: 当m=1时,f(m,n)=n; 当n=1时,f(m,n)=m;
当m>1,n>1时,f(m,n)= f(m-1,n)+ f(m,n-1) 输入
第一行包含一个整数T(1<=T<=100),表示下面的数据组数。
以下T行,其中每组数据有两个整数m,n(1<=m,n<=2000),中间用空格隔开。 输出
对每组输入数据,你需要计算出f(m,n),并输出。每个结果占一行。 示例输入 2 1 1 2 3
示例输出 1 7
#include
void main() { int m,n,t,sum; scanf(\ while(t--) { scanf(\ sum=f(m,n); printf(\ } }
简单计算
Time Limit: 1000MS Memory limit: 65536K
题目描述
接受从键盘输入的N个整数,输出其中的最大值、最小值和平均值。 输入
第一行一个正整数N(N<=100);
第二行有N个用空格隔开的整数Ti (1<= i <=N, 0<= Ti <= 1000) ouput 输出
三个有空格隔开的整数分别为最大值、最小值和平均值。 示例输入 5
1 2 3 5 4
示例输出 5 1 3
#include
int n,a=0,b,i,j,t[100]; scanf(\ for(i=0;i<=n-1;i++) {
scanf(\ a+=t[i]; }
for(i=0;i<=n-2;i++) {
for(j=0;j<=n-i-2;j++) {
if(t[j]>t[j+1]) {
b=t[j];
t[j]=t[j+1]; t[j+1]=b; } } }
printf(\ }
IBM Minus One
Time Limit: 1000MS Memory limit: 65536K
题目描述
You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or the film of the same name by Stanley Kubrick. In it a spaceship is sent from Earth to Saturn. The crew is put into stasis for the long flight, only two men are awake, and the ship is controlled by the intelligent computer HAL. But during the flight HAL is acting more and more strangely, and even starts to kill the crew on board. We don't tell you how the story ends, in case you want to read the book for yourself :-)
After the movie was released and became very popular, there was some discussion as to what the name 'HAL' actually meant. Some thought that it might be an abbreviation for 'Heuristic ALgorithm'. But the most popular explanation is the following: if you replace every letter in the word HAL by its successor in the alphabet, you get ... IBM.
Perhaps there are even more acronyms related in this strange way! You are to write a program that may help to find this out. 输入
The input starts with the integer n on a line by itself - this is the number of strings to follow. The following n lines each contain one string of at most 50 upper-case letters. 输出
For each string in the input, first output the number of the string, as shown in the sample output. The print the string start is derived from the input string by replacing every time by the following letter in the alphabet, and replacing 'Z' by 'A'.
Print a blank line after each test case. 示例输入 2 HAL SWERC 示例输出 String #1 IBM
String #2 TXFSD
#include
char s[50]; int i,a,b,k=1; scanf(\ while(b--) {
scanf(\ a=strlen(s);
printf(\ for(i=0;i
if(s[i]>='A'&&s[i]<='Y') printf(\ else if(s[i]=='Z')
printf(\ }
printf(\ k++; } }
No Brainer
Time Limit: 1000MS Memory limit: 65536K
题目描述
Zombies love to eat brains. Yum. 输入
The first line contains a single integer n indicating the number of data sets.
The following n lines each represent a data set. Each data set will be formatted according to the following description:
A single data set consists of a line \eats and Y is the number of brains the zombie requires to stay alive. 输出
For each data set, there will be exactly one line of output. This line will be \BRAINS\
number of brains the zombie requires to stay alive. Otherwise, the line will be \BRAINS\示例输入 3 4 5 3 3 4 3
示例输出 NO BRAINS MMM BRAINS MMM BRAINS
#include
int n,i,k;
scanf(\ while(n--) {
scanf(\
if(i else if(i>=k) printf(\ } } C语言实验——交换两个整数的值(顺序结构) Time Limit: 1000MS Memory limit: 65536K 题目描述 交换两个变量的值,由终端输入两个整数给变量x、y,然后交换x和y的值后,输出x和y。 输入 从键盘输入两个整数变量x和y; 输出 在交换x、y的值后将x和y输出! 示例输入 4 6 示例输出 6 4 #include
相关推荐:
- [基础教育]2016-2022年中国钢芯铝绞线市场现状调
- [基础教育]语文部编版初一语文下册练习题 句式变
- [基础教育]南京继续教育参考答案--深入学习贯彻习
- [基础教育]国旗下讲话稿——珍惜时间好读书
- [基础教育]北师大版六年级数学下册圆锥的体积教学
- [基础教育]人教版-音乐-四年级下册-四年级下册音
- [基础教育]乔布斯2019年斯坦福大学毕业典礼致辞.d
- [基础教育]2015年加油站安全知识竞赛试题及答案
- [基础教育]2020年教师年度考核个人工作总结
- [基础教育]2019年中考历史试题-2019年大庆市初中
- [基础教育]初三仁爱英语第一轮总复习教案
- [基础教育]SG-A094电气配管安装工程隐蔽验收记录
- [基础教育]冀教版小学数学三年级下册第六单元教材
- [基础教育]青岛版(五制)小学科学二年级下册16《制
- [基础教育]2018-2019年初中科学初一中考真卷测试
- [基础教育]幼儿园大班期末简短评语精选
- [基础教育]2018云南临沧公务员考试申论技巧:这样
- [基础教育]学校食堂经营管理方案
- [基础教育]新中国砥砺奋进的七十年原文
- [基础教育]真空泵的选型及常用计算公式
- 高职田径课程教学现状与对策
- 全髋关节置换术在老年股骨颈骨折患者中
- 青人社厅函〔2016〕576号(附件)工资
- cp101-07砂子检验作业指导书 - secret
- 微观经济学 第八章 博弈论 习题
- 2014高考真题(词语运用)汇编及答案
- 2018年人教版七年级语文下册《第三单元
- 苏教版数学四年级上册第一单元试题 - M
- 四川大学新闻与传播考研2000-2010年真
- 浙江万里学院英语专业四年制本科教学计
- 最新2018马年事业祝福语-范文word版(2
- 最全模具行业术语英文翻译
- 皮亚杰的发展心理学理论
- 64篇高考情景式默写 练习题及答案
- 仿写(学生稿)
- 《SQL Server数据库技术》试卷A
- 第七章作业答案
- 江苏省赣榆县海头高级中学高中语文必修
- 浙江省2001年10月自考正常人体解剖学答
- 2012英语重点短语




