首页 > 其他 > 详细

nyoj 1 A + B Problme

时间:2018-04-23 17:55:22      阅读:197      评论:0      收藏:0      [点我收藏+]

A+B Problem

时间限制:3000 ms  |  内存限制:65535 KB |难度:0
描述
  此题为练手用题,请大家计算一下a+b的值.
输入
  输入两个数,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);
} 

 

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);
  }
}

 

C++版: 

#include <iostream>
#include <algorithm>

using namespace std;

int main() 
{
    int a, b;
    cin >>a >>b;
    cout <<a+b <<endl;
    return 0;
}

 

 

nyoj 1 A + B Problme

原文:https://www.cnblogs.com/GetcharZp/p/8920396.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!