【UOJ 1】A+B problem 快读

Description

输入两个自然数,输出他们的和

Input

两个自然数x和y(0<=x,y<=32767)

Output

一个数,即x和y的和

Sample Input

123 500

Sample output

623

Hint

//C++
#include "iostream"
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    cout << a+b << endl;
    return 0;
}
//C
#include "stdio.h"
int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d
",a+b);
    return 0;
}
#Python
a = input().split()
print(int(a[0])+int(a[1]))

题解:纪念一下我学c++以来第一次写快读
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;

int read(){
    int a=0,k=1;
    char c=getchar();
    while(!isdigit(c)) {
        if(c=='-') k=-1;
        c=getchar();
    }
    while(isdigit(c)){
        a=a*10+c-'0';
        c=getchar();
    }
    return a*k;
}
int n,m;
int main(){
   // freopen("ttt.in","r",stdin);
  //  freopen("ttt.out","w",stdout);
    n=read();
    m=read();
    printf("%d",n+m);
    return 0;
}
原文地址:https://www.cnblogs.com/wuhu-JJJ/p/14030009.html