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;
    }
  • 相关阅读:
    hdu 4403 枚举
    hdu 4405概率dp
    lightoj 1036 dp
    lightoj 1033 区间dp
    lightoj 1032 二进制的dp
    hdu 4293 dp求最大权值不重合区间
    poj 2449 第k短路
    hdu 4284 状态压缩
    hdu4281 区间dp
    poj 2288 tsp经典问题
  • 原文地址:https://www.cnblogs.com/GetcharZp/p/8920396.html
Copyright © 2011-2022 走看看