1:A+B Problem
- 总时间限制:
- 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?- #include <iostream>
- using namespace std;
- int main()
- {
- int a,b;
- cin >> a >> b;
- cout << a+b << endl;
- return 0;
- }
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?- #include <stdio.h>
- int main()
- {
- int a,b;
- scanf("%d %d",&a, &b);
- printf("%d\n",a+b);
- return 0;
- }
Here is a sample solution for problem 1000 using PASCAL:
[plain] view plaincopyprint?- program p1000(Input,Output);
- var
- a,b:Integer;
- begin
- Readln(a,b);
- Writeln(a+b);
- 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?- import java.io.*;
- import java.util.*;
- public class Main
- {
- public static void main(String args[]) throws Exception
- {
- Scanner cin=new Scanner(System.in);
- int a=cin.nextInt(),b=cin.nextInt();
- System.out.println(a+b);
- }
- }
Old program for jdk 1.4
[java] view plaincopyprint?- import java.io.*;
- import java.util.*;
- public class Main
- {
- public static void main (String args[]) throws Exception
- {
- BufferedReader stdin =
- new BufferedReader(
- new InputStreamReader(System.in));
- String line = stdin.readLine();
- StringTokenizer st = new StringTokenizer(line);
- int a = Integer.parseInt(st.nextToken());
- int b = Integer.parseInt(st.nextToken());
- System.out.println(a+b);
- }
- }
-
源代码:
-
[java] view plaincopyprint?
- <pre name="code" class="cpp">int main(void)
- {
- int a, b;
- scanf("%d%d", &a, &b);
- printf("%d", a+b);
- return 0;
- }
转载于:https://www.cnblogs.com/drfxiaoliuzi/p/3864705.html
1:A+B Problem相关推荐
- linux下yum错误:[Errno 14] problem making ssl connection Trying other mirror.
所有的base 都要取消注释 mirrorlist 加上注释 另外所有的enable都要设为零 目录 今天是要yum命令安装EPEL仓库后 yum install epel-release 突然发现y ...
- A + B Problem
1001: A + B Problem Description 计算 A + B. Input 多组测试数据,每组测试数据占一行,包括2个整数. Output 在一行中输出结果. Sample Inp ...
- 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 ...
- #418 Div2 Problem B An express train to reveries (构造 || 全排列序列特性)
题目链接:http://codeforces.com/contest/814/problem/B 题意 : 有一个给出两个含有 n 个数的序列 a 和 b, 这两个序列和(1~n)的其中一个全排列序列 ...
- ADPRL - 近似动态规划和强化学习 - Note 3 - Stochastic Infinite Horizon Problem
Stochastic Infinite Horizon Problem 3.Stochastic Infinite Horizon Problem 定义3.1 无限范围的马尔可夫决策过程 (Marko ...
- ADPRL - 近似动态规划和强化学习 - Note 2 - Stochastic Finite Horizon Problem
2. Stochastic Finite Horizon Problem 在这一节中主要介绍了随机DP算法来解决不确定性下的有限地范围问题,如Denition 1.4所述,它被表述为一个组合优化问题. ...
- There was a problem confirming the ssl certificate ……
在安装一个Python库onetimepass时发生下面的问题: pip install onetimepass Could not fetch URL https://pypi.python.org ...
- 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 & ...
- The C10K problem原文翻译
原文地址:http://www.cnblogs.com/fll/archive/2008/05/17/1201540.html The C10K problem 如今的web服务器需要同时处理一万个以 ...
- 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 > ...
最新文章
- 修改项目名称后,部署到tomcat问题
- 平衡树(模板 and 题目)记录
- 【C语言进阶深度学习记录】二十 结构体大小计算与结构体内存布局的详细方法
- Hibernate day01
- 多伦多大学密西莎加计算机科学,解析加国名校多伦多大学密西沙加校区
- 【Java从0到架构师】SpringBoot - MyBatis
- 使用Android简单实现有道电子词典
- Bailian2811 熄灯问题【暴力】
- listview控件在php的使用方法,VBA窗体之ListView控件的基本应用 | VBA实例教程
- SAP License:ML-物料分类账的未分配差异明细
- matlab神经网络工具箱简介
- Python敏感词汇检测
- 【AAAI 2021】全部接受论文列表(三)
- unity简单实现融合树动画
- 华为畅享20plus能更鸿蒙不,甘南收购华为畅享20Plus尾插排线数据线耳机
- Focal Loss 安装与使用 TensorFlow2.x版本
- parted扩展磁盘分区(实践篇)
- 《他是谁》爆火,优酷的成功并非偶然
- Linux系统开启wifi热点的方法
- som java_SOM网络聚类完整示例(利用python和java)
热门文章
- 移除类名没有触发transition_epoll边缘触发模式
- 机器学习、数据挖掘之中国大牛
- mysql 去空格_MySQL基本命令操作
- snmp trap 如何在浏览器中_SNMP Trap的功能介绍
- linux 关闭setitimer_Linux定时器函数setitimer
- python中seaborn库_GitHub - a13544835729/python-seaborn: python seaborn库基础用法
- 目标检测(三)--DPM
- 人脸对齐(二)--ASM算法
- 记录QT在实时显示摄像头数据时候切换TAB页出现异常
- ES2018 学习笔记(4)Unicode 和 ISO 10646