NYOJ1 - A+B Problem
来源:互联网 发布:雍正王朝 知乎 编辑:程序博客网 时间:2024/06/06 18:46
- 输入
- 输入两个数,a,b
- 输出
- 输出a+b的值
- 样例输入
2 3
- 样例输出
5
- 提示
- 例如:
C语言版:
#include<stdio.h>
int main()
{
int a,b;
scanf("%d%d",&a,&b);
printf("%d\n",a+b);
}
C++版:
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
}
Java版:
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);
}
}
Java jdk 1.4 版
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);
}
}
请注意不要输出过多提示性语句(如:“please input two numbers”),不然会WrongAnswer的#include<stdio.h>int main (){int a,b;scanf("%d%d",&a,&b);printf("%d ",a+b);return 0;}
0 0
- NYOJ1 - A+B Problem
- problem 1000: A+B problem
- Problem 1000 A+B Problem
- Problem - 1000 A + B Problem
- A + B Problem
- A + B Problem
- 1000 A+B Problem
- 1001 A + B Problem
- A+B Problem
- 1000 A+B Problem
- A + B Problem
- A + B Problem
- 1000 A + B Problem
- 1000 A+B Problem
- A + B Problem
- A + B Problem II
- A + B Problem II
- POJ1001 -- A-B Problem
- 判断复选框并写入数据库
- C语言可变参数列表解析及简单应用
- leetcode--104. Maximum Depth of Binary Tree
- 【PAT-T】1014. Circles of Friends (35)
- innerHTML的使用
- NYOJ1 - A+B Problem
- 第七章 类
- 算法之路二:刘汝佳算法竞赛入门经典:STL队列 团体队列UVA540
- RAM和ROM的区别
- 使用informix的ontape实现指定时间点的数据恢复
- 高并发下数据写入与过期
- PAT(甲级)1050. String Subtraction (20)
- p2p服务程序开发
- 共同学习Java源代码-数据结构-NavigableSet接口和SortedSet接口