acm杭电C语言答案,杭电acm部分题目及答案答案

41528d3028836879cd698677c3999917.gif杭电acm部分题目及答案答案

自己刷的题这是我在杭电做题的记录,希望我的分享对你有帮助!!!1001 Sum Problem***********************************************************21089 A+B for -Output Practice (I)********************************41090 A+B for -Output Practice (II)********************************61091 A+B for -Output Practice (III)****************************************81092 A+B for -Output Practice (IV)********************************91093 A+B for -Output Practice (V)********************************111094 A+B for -Output Practice (VI)***************************************121095 A+B for -Output Practice (VII)*******************************131096 A+B for -Output Practice (VIII)******************************14How to Type***************************************************************16 1001 Sum ProblemProblem DescriptionHey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + . + n.The will consist of a series of integers n, one integer per line.OutputFor each case, output SUM(n) in one line, followed by a blank line. You may assume the result will be in the range of 32-bit signed integer.Sample 1100Sample Output15050AuthorDOOM III解答:#includemain(){int n,i,sum;sum=0;while((scanf(“%d“,for(i=0;imain(){int a,b;while(scanf(“%d%d“,}1090 A+B for -Output Practice (II)Problem DescriptionYour 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. OutputFor 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 21 510 20Sample Output630AuthorlcyRecommendJGShining解答:#include#define M 1000void main(){ int a ,b,n,j[M],i;//printf(“please n:\n“);scanf(“%d“,for(i=0;imain(){int a,b;scanf(“%d %d“,while(!(a==0scanf(“%d %d“,}}1092 A+B for -Output Practice (IV)Problem DescriptionYour 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.OutputFor 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 45 1 2 3 4 50 Sample Output1015AuthorlcyRecommendJGShining解答:#include int main(){int n,sum,i,t;while(scanf(“%d“,for(i=0;imain(){int n,a,b,i,j,sum;sum=0;while(scanf(“%d\n“,imain(){int n,a,b,i,j,sum;sum=0;while(scanf(“%d\n“,jmain(){int a,b;while(scanf(“%d%d“,}1096 A+B for -Output Practice (VIII)Problem DescriptionYour 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. OutputFor each group of

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值