杭电c语言课程设计实验6答案,杭电题目acm答案.doc

杭电题目acm答案.doc

选修课考试作业 1001 Sum Problem 2 1089 AB for -Output Practice I . 4 1090 AB for -Output Practice II . 6 1091 AB for -Output Practice III 8 1092 AB for -Output Practice IV . 9 1093 AB for -Output Practice V . 11 1094 AB for -Output Practice VI 13 1095 AB for -Output Practice VII 14 1096 AB for -Output Practice VIII . 16 2000 ASCII 码排序 17 2001 计算两点间的距离 19 2002 计算球体积 20 2003 求绝对值 21 2004 成绩转换 22 2005 第几天 24 2006 求奇数的乘积 26 2007 平方和与立方和 27 2008 数值统计 28 2009 求数列的和 30 2010 水仙花数 31 2011 多项式求和 33 2012 素数判定 34 2014 青年歌手大奖赛 _评委会打分 36 2015 偶数求和 38 2016 数据的交换输出 40 2017 字符串统计 42 2019 数列有序 43 2020 绝对值排序 45 2021 发工资咯) 46 2033 人见人爱 AB . 48 2039 三角形 50 2040 亲和数 51 姓名郑春杰 班级电商 1001 学号 1010504134 1001 Sum Problem Problem Description Hey, welcome to HDOJHangzhou Dianzi University Online Judge. In this problem, your task is to calculate SUMn 1 2 3 . n. The will consist of a series of integers n, one integer per line. Output For each case, output SUMn in one line, followed by a blank line. You may assume the result will be in the range of 32-bit signed integer. Sample 1 100 Sample Output 1 5050 Author DOOM III 解答 include main int n,i,sum; sum0; whilescanf“d“, fori0;i main int a,b; whilescanf“dd“, 1090 AB for -Output Practice II Problem Description Your task is to Calculate a b. contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line. Output For each pair of integers a and b you should output the sum of a and b in one line, and with one line of output for each line in . Sample 2 1 5 10 20 Sample Output 6 30 Author lcy Recommend JGShining 解答 include define M 1000 void main int a ,b,n,jM,i; printf“please nn“; scanf“d“, fori0;i main int a,b; scanf“d d“, whilea0 scanf“d d“, 1092 AB for -Output Practice IV Problem Description Your task is to Calculate the sum of some integers. contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the and this test case is not to be processed. Output For each group of integers you should output their sum in one line, and with one line of output for each line in . Sample 4 1 2 3 4 5 1 2 3 4 5 0 Sample Output 10 15 Author lcy Recommend JGShining 解答 include int main int n,sum,i,t; whilescanf“d“, fori0;i main int n,a,b,i,j,sum; sum0; whilescanf“dn“,i main int n,a,b,i,j,sum; sum0; whilescanf“dn“,j main int a,b; whilescanf“dd“, 1096 AB for -Output Practice VIII Problem Description Your task is to calculate the sum of some integers. contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line. Output For each group of integers you should output their sum in one line, and you must note that there is a blank line between outputs. Sample 3 4 1 2 3 4 5 1 2 3 4 5 3 1 2 3 Sample Output 10 15 6 Author lcy Recommend JGShining 解答 int main int a,b,i,j,l1000,k; scanf“d“, getchar; forj1;j main char a,b,c,d; whilescanf“c c c“, ifab ifca printf“c c cn“,b,a,c; else ifbc printf“c c cn“,c,b,a; else ifbb printf“c c cn“,a,b,c; else ifca printf“c c cn“,a,c,b; else ifac printf“c c cn“,c,a,b; 2001 计算两点间的距离 Problem Description 输入两点坐标( X1,Y1) ,( X2,Y2) ,计算并输出两点间的距离。 输入数据有多组,每组占一行,由 4 个实数组成,分别表示 x1,y1,x2,y2,数据之间用空格隔开。 Output 对于每组输入数据,输出一行,结果保留两位小数。 Sample 0 0 0 1 0 1 1 0 Sample Output 1.00 1.41 Author lcy Source C 语言程序设计练习(一) Recommend JGShining 解答 include include main double a,b,c,d,s; whilescanf“lf lf lf lf“, printf“.2lfn“,s; 2002 计算球体积 Problem Description 根据输入的半径值,计算球的体积。 输入数据有多组,每组占一行,每行包括一个实数,表示球的半径。 Output 输出对应的球的体积,对于每组输入数据,输出一行,计算结果保留三位小数。 Sample 1 1.5 Sample Output 4.189 14.137 Hint define PI 3.1415927 Author lcy Source C 语言程序设计练习(一) Recommend JGShining 解答 include define PI 3.1415927 main double a,v; whilescanf“lf“, printf“.3lfn“,v; 2003 求绝对值 Problem Description 求实数的绝对值。 输入数据有多组,每组占一行,每行包含一个实数。 Output 对于每组输入数据,输出它的绝对值,要求每组数据输出一行,结果保留两位小数。 Sample 123 -234.00 Sample Output 123.00 234.00 Author lcy Source C 语言程序设计练习(一) Recommend JGShining 解答 include main double a; whilescanf“lf“, whilescanf“d“, else ifn80printf“Bn“; else ifn70printf“Cn“; else ifn60printf“Dn“; else printf“En“; return 0; 2005 第几天 Problem Description 给定一个日期,输出这个日期是该年的第几天。 输入数据有多组,每组占一行,数据格式为 YYYY/MM/DD 组成,具体参见 sample ,另外,可以向你确保所有的输入数据是合法的。 Output 对于每组输入数据,输出一行,表示该日期是该年的第几天。 Sample 1985/1/20 2006/3/12 Sample Output 20 71 Author lcy Source C 语言程序设计练习(一) Recommend JGShining 解答 include main int a,b,c,d,e,f,g; whilescanf“d/d/d“, else ifb2 d31c; else ifb3 d3128c; else ifb4 d312831c; else ifb5 d31312830c; else ifb6 d3128313031c; else ifb7 d312831303130c; else ifb8 d31283130313031c; else ifb9 d3128313031303131c; else ifb10 d312831303130313130c; else ifb11 d31283130313031313031c; else ifb12 d31283130313031313031c30; ea100; fa400; ga4; ife0 iff0 d1d; else dd; else ifg0 dd1; else dd; printf“dn“,d; 2006 求奇数的乘积 Problem Description 给你 n 个整数,求他们中所有奇数的乘积。 输入数据包含多个测试实例,每个测试实例占一行,每行的第一个数为 n,表示本组数据一共有 n 个,接着是 n 个整数,你可以假设每组数据必定至少存在一个奇数。 Output 输出每组数中的所有奇数的乘积,对于测试实例,输出一行。 Sample 3 1 2 3 4 2 3 4 5 Sample Output 3 15 Author lcy Source C 语言程序设计练习(一) Recommend JGShining 解答 include main int n,s,i,a; whilescanf“d“, fori0;i int main int sum1,sum2,n,i,m,t; whilescanf“dd“, ifmntm;mn;nt; forim;i int main int n,i,b1,b2,b3; double a101; whilescanf“d“,in;i scanf“lf“, b1b2b30; fori0;in;i ifai0 b1; else ifai0 b2; else b3; printf“d d dn“,b1,b2,b3; 2009 求数列的和 Problem Description 数列的定义如下 数列的第一项为 n,以后各项为前一项的平方根,求数列的前 m 项的和。 输入数据有多组,每组占一行,由 两个整数 n( n10000)和 mm1000组成, n 和 m 的含义如前所述。 Output 对于每组输入数据,输出该数列的和,每个测试实例占一行,要求精度保留 2 位小数。 Sample 81 4 2 2 Sample Output 94.73 3.41 Author lcy

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值