总时间限制: 
1000ms 
内存限制: 
65536kB
描述

Calculate a + b

输入
Two integer a,,b (0 ≤ a,b ≤ 10)
输出
Output a + b
样例输入
1 2
样例输出
3
提示
Q: Where are the input and the output?

A: Your program shall always read input from stdin (Standard Input) and write output to stdout (Standard Output). For example, you can use 'scanf' in C or 'cin' in C++ to read from stdin, and use 'printf' in C or 'cout' in C++ to write to stdout.

You shall not output any extra data to standard output other than that required by the problem, otherwise you will get a "Wrong Answer".

User programs are not allowed to open and read from/write to files. You will get a "Runtime Error" or a "Wrong Answer" if you try to do so.

Here is a sample solution for problem 1000 using C++/G++:

[cpp] view plaincopyprint?
  1. #include <iostream>
  2. using namespace std;
  3. int  main()
  4. {
  5. int a,b;
  6. cin >> a >> b;
  7. cout << a+b << endl;
  8. return 0;
  9. }

It's important that the return type of main() must be int when you use G++/GCC,or you may get compile error.

Here is a sample solution for problem 1000 using C/GCC:

[cpp] view plaincopyprint?
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int a,b;
  5. scanf("%d %d",&a, &b);
  6. printf("%d\n",a+b);
  7. return 0;
  8. }

Here is a sample solution for problem 1000 using PASCAL:

[plain] view plaincopyprint?
  1. program p1000(Input,Output);
  2. var
  3. a,b:Integer;
  4. begin
  5. Readln(a,b);
  6. Writeln(a+b);
  7. end.

Here is a sample solution for problem 1000 using JAVA:

Now java compiler is jdk 1.5, next is program for 1000

[java] view plaincopyprint?
  1. import java.io.*;
  2. import java.util.*;
  3. public class Main
  4. {
  5. public static void main(String args[]) throws Exception
  6. {
  7. Scanner cin=new Scanner(System.in);
  8. int a=cin.nextInt(),b=cin.nextInt();
  9. System.out.println(a+b);
  10. }
  11. }

Old program for jdk 1.4

[java] view plaincopyprint?
  1. import java.io.*;
  2. import java.util.*;
  3. public class Main
  4. {
  5. public static void main (String args[]) throws Exception
  6. {
  7. BufferedReader stdin =
  8. new BufferedReader(
  9. new InputStreamReader(System.in));
  10. String line = stdin.readLine();
  11. StringTokenizer st = new StringTokenizer(line);
  12. int a = Integer.parseInt(st.nextToken());
  13. int b = Integer.parseInt(st.nextToken());
  14. System.out.println(a+b);
  15. }
  16. }

源代码:

[java] view plaincopyprint?
  1. <pre name="code" class="cpp">int main(void)
  2. {
  3. int a, b;
  4. scanf("%d%d", &a, &b);
  5. printf("%d", a+b);
  6. return 0;
  7. }

转载于:https://www.cnblogs.com/drfxiaoliuzi/p/3864705.html

1:A+B Problem相关推荐

  1. linux下yum错误:[Errno 14] problem making ssl connection Trying other mirror.

    所有的base 都要取消注释 mirrorlist 加上注释 另外所有的enable都要设为零 目录 今天是要yum命令安装EPEL仓库后 yum install epel-release 突然发现y ...

  2. A + B Problem

    1001: A + B Problem Description 计算 A + B. Input 多组测试数据,每组测试数据占一行,包括2个整数. Output 在一行中输出结果. Sample Inp ...

  3. Error:(49, 1) A problem occurred evaluating project ':guideview'. Could not read script 'https://r

    出现问题如下: Error:(49, 1) A problem occurred evaluating project ':guideview'. > Could not read script ...

  4. #418 Div2 Problem B An express train to reveries (构造 || 全排列序列特性)

    题目链接:http://codeforces.com/contest/814/problem/B 题意 : 有一个给出两个含有 n 个数的序列 a 和 b, 这两个序列和(1~n)的其中一个全排列序列 ...

  5. ADPRL - 近似动态规划和强化学习 - Note 3 - Stochastic Infinite Horizon Problem

    Stochastic Infinite Horizon Problem 3.Stochastic Infinite Horizon Problem 定义3.1 无限范围的马尔可夫决策过程 (Marko ...

  6. ADPRL - 近似动态规划和强化学习 - Note 2 - Stochastic Finite Horizon Problem

    2. Stochastic Finite Horizon Problem 在这一节中主要介绍了随机DP算法来解决不确定性下的有限地范围问题,如Denition 1.4所述,它被表述为一个组合优化问题. ...

  7. There was a problem confirming the ssl certificate ……

    在安装一个Python库onetimepass时发生下面的问题: pip install onetimepass Could not fetch URL https://pypi.python.org ...

  8. HDU 1757 A Simple Math Problem

    Problem Description Lele now is thinking about a simple function f(x). If x < 10 f(x) = x. If x & ...

  9. The C10K problem原文翻译

    原文地址:http://www.cnblogs.com/fll/archive/2008/05/17/1201540.html The C10K problem 如今的web服务器需要同时处理一万个以 ...

  10. This is probably not a problem with npm. There is likely additional logging output above

    微信小程序开发交流qq群   173683895    承接微信小程序开发.扫码加微信. E:\weii_objct\invoice-manage-web-view>npm start > ...

最新文章

  1. 修改项目名称后,部署到tomcat问题
  2. 平衡树(模板 and 题目)记录
  3. 【C语言进阶深度学习记录】二十 结构体大小计算与结构体内存布局的详细方法
  4. Hibernate day01
  5. 多伦多大学密西莎加计算机科学,解析加国名校多伦多大学密西沙加校区
  6. 【Java从0到架构师】SpringBoot - MyBatis
  7. 使用Android简单实现有道电子词典
  8. Bailian2811 熄灯问题【暴力】
  9. listview控件在php的使用方法,VBA窗体之ListView控件的基本应用 | VBA实例教程
  10. SAP License:ML-物料分类账的未分配差异明细
  11. matlab神经网络工具箱简介
  12. Python敏感词汇检测
  13. 【AAAI 2021】全部接受论文列表(三)
  14. unity简单实现融合树动画
  15. 华为畅享20plus能更鸿蒙不,甘南收购华为畅享20Plus尾插排线数据线耳机
  16. Focal Loss 安装与使用 TensorFlow2.x版本
  17. parted扩展磁盘分区(实践篇)
  18. 《他是谁》爆火,优酷的成功并非偶然
  19. Linux系统开启wifi热点的方法
  20. som java_SOM网络聚类完整示例(利用python和java)

热门文章

  1. 移除类名没有触发transition_epoll边缘触发模式
  2. 机器学习、数据挖掘之中国大牛
  3. mysql 去空格_MySQL基本命令操作
  4. snmp trap 如何在浏览器中_SNMP Trap的功能介绍
  5. linux 关闭setitimer_Linux定时器函数setitimer
  6. python中seaborn库_GitHub - a13544835729/python-seaborn: python seaborn库基础用法
  7. 目标检测(三)--DPM
  8. 人脸对齐(二)--ASM算法
  9. 记录QT在实时显示摄像头数据时候切换TAB页出现异常
  10. ES2018 学习笔记(4)Unicode 和 ISO 10646