杭电OJ的输入输出格式题教案.doc

  1. 1、本文档共18页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
杭电OJ的输入/输出格式题 输入 一、1000 A + B Problem 题目名称:A + B Problem 链接地址:/showproblem.php?pid=1000 Time Limit: 1 Seconds????Memory Limit:32768K Time Limit: 2000/1000 MS (Java/Others) ? ?Memory Limit: 65536/32768 K (Java/Others) Problem Description Calculate A + B. Input Each line will contain two integers A and B. Process to end of file. Output For each case, output A + B in one line. Sample Input 1 1 Sample Output 2 参考答案 #include stdio.h int main(void) { int a,b; while(scanf(%d%d,a,b)!=EOF) printf(%d\n,a+b); return 0; } 二、1002 A + B Problem II 题目名称:A + B Problem II 链接地址:/showproblem.php?pid=1002 Time Limit: 1 Seconds????Memory Limit:32768K Time?Limit:?2000/1000?MS?(Java/Others)?Memory?Limit:?65536/32768?K?(Java/Others) Total?Submission(s):?22627?Accepted?Submission(s):?4035 Problem?Description I?have?a?very?simple?problem?for?you.?Given?two?integers?A?and?B,?your?job?is?to?calculate?the?Sum?of?A?+?B. Input The?first?line?of?the?input?contains?an?integer?T(1=T=20)?which?means?the?number?of?test?cases.?Then?T?lines?follow,?each?line?consists?of?two?positive?integers,?A?and?B.?Notice?that?the?integers?are?very?large,?that?means?you?should?not?process?them?by?using?32-bit?integer.?You?may?assume?the?length?of?each?integer?will?not?exceed?1000. Output For?each?test?case,?you?should?output?two?lines.?The?first?line?is?Case?#:,?#?means?the?number?of?the?test?case.?The?second?line?is?the?an?equation?A?+?B?=?Sum,?Sum?means?the?result?of?A?+?B.?Note?there?are?some?spaces?int?the?equation.?Output?a?blank?line?between?two?test?cases. Sample?Input 2 1?2 112233445566778899?998877665544332211 Sample?Output Case?1: 1?+?2?=?3 Case?2: 112233445566778899?+?998877665544332211?=?1111111111111111110 思路: ??。不超过1000位,也就是说用整型数定义是不行的,然后想到的就是用数组。具体解题思路如下: ??1先定义两个字符型数组,保存,然后再定义整型数组,保存两加数的和 ??2、下面来求和计算,字符型数组字符型数组,。 ?最后就是格式控制好输出。#include stdio.h #include string.h #include stdlib.h int main() { char str1[1005],str2[1005]; int n,count=0,i,j,flag; int a[1005]; scanf(%d,n); w

文档评论(0)

502992 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档