个人做题总结,希望能够帮助到未来的学弟学妹们的学习!

永远爱你们的

————新宝宝

1:

题目描述

Your 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 input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.

输出

For each pair of input 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 input.

样例输入

1 5

10 20

样例输出

6

30

可运行的代码:

#include<stdio.h>
int main()
{
int a,b;
while(scanf("%d%d",&a,&b)==2)
printf("%d\n",a+b);
}

////////////////

#include<stdio.h>
int main()
{
int a,b;
while(scanf("%d%d",&a,&b)!=EOF)
printf("%d\n",a+b);
return 0;
}

2:

题目描述

The first line integer means the number of input integer a and b. Your task is to Calculate a + b.

输入

Your task is to Calculate a + b. The first line integer means the numbers of pairs of input integers.

输出

For each pair of input 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 input.

样例输入

2

1 5

10 20

样例输出

6

30

可运行的代码:

#include<stdio.h>
int main()
{
  int a,b ;
  int n,sum=0;
  scanf("%d",&n);
  while(n--)
  {
  scanf("%d%d",&a,&b);
  sum=a+b;
  printf("%d\n",sum);

}
   return 0;

}

//////////////////////

#include<stdio.h>
int main()
{
    int a,b;
    while(~scanf("%d%d", &a, &b))printf("%d\n",a+b);
    return 0;
}

3:

题目描述

Your task is to Calculate a + b.

输入

Input 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 input and this test case is not to be processed.

输出

For each pair of input 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 input.

样例输入

1 5

10 20

0 0

样例输出

6

30

可以运行的代码:

#include<stdio.h>
int main()
{
 int a,b;
 while(scanf("%d%d",&a,&b)==2)
 {
 if(a== 0 && b==0)
 break;
 printf("%d\n",a+b);
 }
 return 0;
}

4:

题目描述

Your task is to Calculate the sum of some integers.

输入

Input 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 input and this test case is not to be processed.

输出

For each group of input integers you should output their sum in one line, and with one line of output for each line in input.

样例输入

4 1 2 3 4

5 1 2 3 4 5

0

样例输出

10

15

可运行代码:

#include<stdio.h>

int main()
{
int n,a,i=0,sum=0;

while(scanf("%d",&n)&&n!=0)
{
  for(i=0;i<n;i++)

  {scanf("%d",&a);sum+=a;}
   printf("%d\n",sum);
   sum=0;
}

return 0;
}

////////////////////////////////////////

#include<stdio.h>
int main()
{
int N,i,a;
int sum=0;
    while(scanf("%d",&N)==1)
    {
    if(N==0)
    break;
    sum=0;
    while(N--)
    {
    scanf("%d",&a);
    sum=sum+a;

}
printf("%d\n",sum);
}
return 0;
 }

5:

题目描述

Your task is to calculate the sum of some integers.

输入

Input 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.

输出

For each group of input integers you should output their sum in one line, and with one line of output for each line in input.

样例输入

2

4 1 2 3 4

5 1 2 3 4 5

样例输出

10

15

可运行代码:

#include<stdio.h>
int main()
{
int N,a,M;
int sum=0;
scanf("%d",&N);
    while(N--)
{
    sum=0;
    scanf("%d",&M);
    while(M--)
    {
    scanf("%d",&a);
    sum=sum+a;
    }
printf("%d\n",sum);
}
return 0;
}

6:

题目描述

Your task is to calculate the sum of some integers.

输入

Input 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.

输出

For each test case you should output the sum of N integers in one line, and with one line of output for each line in input.

样例输入

4 1 2 3 4

5 1 2 3 4 5

样例输出

10

15

可运行代码:

#include<stdio.h>
int main()
{
int n,a,sum=0;

while(scanf("%d",&n)!=EOF)
{ int i=0;

  while(i<n)
  {scanf("%d",&a);sum+=a;i++;}
  printf("%d\n",sum);
  sum=0;

}
return 0;
}

7;

题目描述

Your task is to Calculate a + b.

输入

The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.

输出

For each pair of input integers a and b you should output the sum of a and b, and followed by a blank line.

样例输入

1 5

10 20

样例输出

6

30

可运行代码:

#include<stdio.h>
int main()
{
 int a,b;
 while(scanf("%d%d",&a,&b)!=EOF)
{
  printf("%d\n",a+b);
  printf("\n");
}
 return 0;
}

///////////////////////////

#include<stdio.h>
int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b)==2)
    {
        printf("%d\n",a+b);
        printf("\n");
    }
    return 0;
}

8:

题目描述

Your task is to calculate the sum of some integers

输入

Input 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

输出

For each group of input integers you should output their sum in one line, and you must note that there is a blank line between outputs.

样例输入

3

4 1 2 3 4

5 1 2 3 4 5

3 1 2 3

样例输出

10

15

6

可运行代码:

#include<stdio.h>
int main()
{
int n,n1,a,sum=0;
scanf("%d",&n);
for(int i=0;i<n;i++)
  {
    scanf("%d",&n1);
    for(int j=0;j<n1;j++)
     {
       scanf("%d",&a);
       sum+=a;
     }
    printf("%d\n",sum);
    printf("\n");
    sum=0;
  }
return 0;
}

我很菜,所以我会努力的!

努力是因为不想让在乎的人失望!

博主整理不易,如果喜欢推荐关注一下博主哦!

博主喜欢广交好友下面是我的联系方式:

QQ:1263030049

加好友前请注明原因谢谢!

ACM——八大输出方式总结的更多相关文章

  1. Qt在VS2013或Qt Creator 中的控制台输出方式设置

    首先值得注意的是:在写程序的时候,项目保存路径不要涉及到中文,否则容易出错! 一.Qt在VS2013中的控制台输出方式: 注意:这里是而不是Qt Application. 然后直接点击finish即可 ...

  2. 基础篇:1.JavaScript运行在html中,引用有几种方式?—— 6.js中常用的输出方式?

    书接上文,上文提到若干条JavaScript的基础性知识,大部分都是一些概念性的东西,本着认真严谨的态度,我们要认真对待,有些条目的问题是某个知识点的周边延伸,为节约篇幅,就一起整理了,如有描述不对的 ...

  3. JavaScrip——简单练习(输出方式,简单表单验证)

    <script> //输出方式 document.write(Date());//获取当前时间 document.write(1); document.write("<p& ...

  4. PHP的输出方式

    php中,用echo输出一个字符串有三种方式,分别是单引号,双引号和<<<方式.其中,单引号中的变量不会被解析,而会直接输出,而双引号和<<<时,变量会被解析.&l ...

  5. (3)分布式下的爬虫Scrapy应该如何做-递归爬取方式,数据输出方式以及数据库链接

    放假这段时间好好的思考了一下关于Scrapy的一些常用操作,主要解决了三个问题: 1.如何连续爬取 2.数据输出方式 3.数据库链接 一,如何连续爬取: 思考:要达到连续爬取,逻辑上无非从以下的方向着 ...

  6. php课程 1-3 字符串变量输出方式有哪些(总结:四种)

    php课程 1-3 字符串变量输出方式有哪些(总结:四种) 一.总结 一句话总结:推荐使用双引号中加{$变量名}的形式(echo "my name is {$name}eee !" ...

  7. java 集合遍历输出方式

    Iterator:迭代输出 一旦操作集合的遍历输出,首选Iterator接口; ListIterator:Iterator子接口,专门输出List中的元素; Enumeration:古老的输出方式,迭 ...

  8. 浅谈集合框架四——集合扩展:集合循环输出方式及list输出方式的效率对比

    最近刚学完集合框架,想把自己的一些学习笔记与想法整理一下,所以本篇博客或许会有一些内容写的不严谨或者不正确,还请大神指出.初学者对于本篇博客只建议作为参考,欢迎留言共同学习. 之前有介绍集合框架的体系 ...

  9. Arduino通信篇系列之print()和write()输出方式的差异

    我们都知道,在HardwareSerial类中有print()和write()两种输出方式, 两个都可以输出数据,但其输出方式并不相同. 例子: float FLOAT=1.23456; int IN ...

随机推荐

  1. 简单验证码的识别:Bitmap类的使用

    验证码的智能识别是一项比较复杂的工作,甚至需要掌握点图像学的知识. 当然对于写程序的来说不用那么深入,只需要掌握几个常规步骤就行了. 验证码图像识别步骤:1.获取图像 2.清除边框 3.灰度处理 4. ...

  2. VirtualBox虚拟机网络设置(四种方式)

    原文地址: https://www.douban.com/group/topic/15558388/ VirtualBox的提供了四种网络接入模式,它们分别是: 1.NAT 网络地址转换模式(NAT, ...

  3. DjangoUeditor项目的集成

    DjangoUeditor这个项目,出品人已经不再提供维护支持. 最近在一个使用到aliyun oss的项目里集成了一次这个东西,当然我之前在普通文件上传的北京下已经集成过很多次了. 主要修改的东西就 ...

  4. Django push: Using Server-Sent Events and WebSocket with Django

    http://curella.org/blog/2012/jul/17/django-push-using-server-sent-events-and-websocket/ The goal of ...

  5. Centos 7安装python3

    纯傻瓜式步骤,保证成功. 下面的操作,按照步骤来就可以了,不要在中途cd 到别的文件目录下,要想查看效果可以用 lsj加上对应的目录,不需要切换进去. 首先不管你当前在哪个目录下,输入以下命令. [r ...

  6. 八爪鱼在哪里设置xpath

    分享:35个做好的爬虫规则+160篇图文教程汇总 一般在八爪鱼中,获取网页上某个元素的XPATH有以下几种方式:一.在内置浏览器中点选的操作,八爪鱼自动识别XPATH.但是有时候,自动识别的可能不准确 ...

  7. 利用redis自制幻灯片弹幕

    前段时间赶项目,忙结婚,各大技术平台都没时间上,不过还是抽出点时间为自己的婚礼做了一点小玩具,今天我就来给大家分享一下. 先来看一下效果 这个项目是基于微信个人订阅号的,订阅号的开发在此我就不再赘述了 ...

  8. html标签分类

    在这里做个存档吧,区分一下常用的html标签,行内元素.块状元素.行内块状元素! 那个h标签下面的三横是<hr>标签. 顺便给个附加的css,你们仔细体会一下 body *{border: ...

  9. JS windows对象的top属性

    原博文:http://www.jb51.net/article/44078.htm   本文为大家介绍下JS window对象的top.parent.opener含义,不了解的朋友可以参考下,希望对大 ...

  10. Android之淘宝商品列表长按遮罩效果

    先来看看淘宝.唯品会长按商品的效果,以及简单Demo的效果:        首先分析一下场景: 长按条目时,弹出遮罩的效果遮挡在原来的条目布局上: 页面滑动或点击其他的条目,上一个正在遮罩的条目遮罩消 ...