zoukankan      html  css  js  c++  java
  • nyoj 1 A + B Problme

    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;
    }
  • 相关阅读:
    强迫症患者
    GG的匹配串
    漂洋过海来看你
    Fire or Retreat
    1011. A+B和C (15)
    1010. 一元多项式求导 (25)
    1009. 说反话 (20)
    1008. 数组元素循环右移问题 (20)
    1007. 素数对猜想 (20)
    1006. 换个格式输出整数 (15)
  • 原文地址:https://www.cnblogs.com/GetcharZp/p/8920396.html
Copyright © 2011-2022 走看看