杭电oj1094c语言答案,杭电acm部分题目及答案答案.doc

杭电acm部分题目及答案答案.doc

自己刷的题 这是我在杭电做题的记录,希望我的分享对你有帮助1001 Sum Problem*21089 AB for -Output Practice I41090 AB for -Output Practice II61091 AB for -Output Practice III81092 AB for -Output Practice IV91093 AB for -Output Practice V111094 AB for -Output Practice VI*121095 AB for -Output Practice VII*131096 AB for -Output Practice VIII14How to Type*16 1001 Sum ProblemProblem DescriptionHey, 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.OutputFor 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 1100Sample Output15050AuthorDOOM III解答includestdio.hmain int n,i,sum; sum0; whilescanfd,n-1 sum0; fori0;in;i sumi; printfdnn,sum; 1089 AB for -Output Practice IProblem DescriptionYour task is to Calculate a b.Too easy Of course I specially designed the problem for acm beginners. You must have found that some problems have the same titles with this one, yes, all these problems were designed for the same aim. The will consist of a series of pairs 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 1 510 20Sample Output630AuthorlcyRecommendJGShining解答includestdio.h main int a,b; whilescanfdd,a,bEOF printfdn,ab; 1090 AB for -Output Practice IIProblem 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 解答includestdio.hdefine M 1000void main int a ,b,n,jM,i; printfplease nn; scanfd,n; fori0;in;i scanfdd,a,b; printfd d,a,b; jiab; i0; whilein printfd,ji; i; printfn; 1091 AB for -Output Practice IIIProblem DescriptionYour task is to Calculate a b. contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the and this test case is not to be processed.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 1 510 200 0Sample Output630AuthorlcyRecommendJGShining解答includestdio.h main int a,b; scanfd d,a,b; whilea0b0 printfdn,ab; scanfd d,a,b; 1092 AB for -Output Practice IVProblem 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 stdio.hint main int n,sum,i,t; whilescanfd,nEOFn0 sum0; fori0;in;i scanfd,t; sumsumt; printfdn,sum; 1093 AB for -Output Practice VProblem 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 integers you should output their sum in one line, and with one line of output for each line in . Sample 24 1 2 3 45 1 2 3 4 5Sample Output1015Authorlcy解答includestdio.hmain int n,a,b,i,j,sum; sum0; whilescanfdn,n-1 fori0;in;i scanfd,b; forj0;jb;j scanfd,a; suma; printfdn,sum; sum0; 杭州电子科技大学acm习题精选1094 AB for -Output Practice VIProblem DescriptionYour task is to calculate the sum of some integers. contains multiple test cases, and one case one line. Each case starts with an integer N, and then N integers follow in the same line. OutputFor each test case you should output the sum of N integers in one line, and with one line of output for each line in . Sample 4 1 2 3 45 1 2 3 4 5Sample Output1015AuthorlcyRecommendJGShining解答includestdio.hmain int n,a,b,i,j,sum; sum0; whilescanfdn,n-1 forj0;jn;j scanfd,a; suma; printfdn,sum; sum0; Copy to Clipboard Save to File1095 AB for -Output Practice VIIProblem DescriptionYour task is to Calculate a b.The will consist of a series of pairs 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, and followed by a blank line. Sample 1 510 20Sample Output630AuthorlcyRecommendJGShining解答includestdio.h main int a,b; whilescanfdd,a,bEOF printfdnn,ab; 1096 AB for -Output Practice VIIIProblem 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 integers you should output their sum in one line, and you must note that there is a blank line between outputs.Sample 34 1 2 3 45 1 2 3 4 53 1 2 3Sample Output10156AuthorlcyRecommendJGShining解答int main int a,b,i,j,l1000,k; scanfd,i; getchar; forj1;ji;j lj0; forj1;ji;j scanfd,a; getchar; fork1;ka;k scanfd,b; getchar; ljb; forj1;ji-1;j printfdnn,lj; printfdn,li; How to Type Problem DescriptionPirates have finished developing the typing software. He called Cathy to test his typing software. She is good at thinking. After testing for several days, she finds that if she types a string by some ways, she will type the key at least. But she has a bad habit that if the caps lock is on, she must turn off it, after she finishes typing. Now she wants to know the smallest times of typing the key to finish typing a string. The first line is an integer t t100, which is the number of test case in the file. For each test case, there is only one string which consists of lowercase letter and upper case letter. The length of the string is at most 100. OutputFor each test case, you must output the smallest times of typing the key to finish typing this string. 第 20 页 共 20 页Sample 3PiratesHDUacmHDUACMSample Output888include stdio.hinclude string.hdefine MAX 200int arrMAX4;char strMAX;int letterchar ch ifchAchZ return 1; return 0;void proc int i; int tmp,min; int lenstrlenstr; fori0;ilen;i ifi0 ifletterstri arri12; arri22; else arri01; arri33; else ifletterstriletterstri-1 ifarri-10 arri0arri-101;arri3arri-103; ifarri-11 arri1arri-112; arri2arri-112; ifarri-12 ifarri0arri-121arri0 arri0arri-121; ifarri3arri-123arri3 arri3arri-123; ifarri-13 ifarri1arri-132arri1 arri1arri-132; ifarri2arri-132arri2 arri2arri-132; else ifarri-10 arri1arri-102; arri2arri-102; ifarri-11 arri0arri-111; arri3arri-113; ifarri-12 ifarri1arri-122arri1 arri1arri-122; ifarri2arri-122arri2 arri2arri-122; ifarri-13 ifarri0arri-131arri0 arri0arri-131; ifarri3arri-133arri3 arri3arri-133; min3*MAX; ifletterstrlen-1 ifarrlen-10 tmparrlen-101; iftmpmin mintmp; ifarrlen-11 tmparrlen-11; iftmpmin mintmp; ifarrlen-12 tmparrlen-121; iftmpmin mintmp; ifarrlen-13 tmparrlen-13; iftmpmin mintmp; else ifarrlen-10 tmparrlen-10; iftmpmin mintmp; ifarrlen-11 tmparrlen-111; iftmpmin mintmp; ifarrlen-12 tmparrlen-12; iftmpmin mintmp; ifarrlen-13 tmparrlen-131; iftmpmin mintmp; printfdn,min;Caps Shift0-00;1-01;2-10;3-11int main int num; scanfd,num; whilenum scanfs,str; memsetarr,0,strlenstr*4*sizeofint; proc; return 0;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值