A + B
Time Limit: 2.0 s
Memory Limit: 128.0 MB
Background
Special for beginners, ^_^
Description
Given two integers x and y, print the sum.
Format
Input
Two integers x and y, satisfying 0 <= x, y <= 32767.
Output
One integer, the sum of x and y.
Sample
Input | Output |
---|---|
|
|
|
|
Hint
C Code
#include <stdio.h>
int main(void)
{
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", a + b);
return 0;
}
C++ Code
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a + b << endl;
return 0;
}
C# Code
using System;
using System.Linq;
class Program {
public static void Main(string[] args) {
Console.WriteLine(Console.ReadLine().Split().Select(int.Parse).Sum());
}
}
Python Code
a, b = list(map(int, input().split()))
print(a + b)
Java Code
import java.io.*;
import java.util.Scanner;
public class Main {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(a + b);
}
}
Ruby Code
a, b = gets.split.map(&:to_i)
puts(a + b)
Kotlin
fun main() {
val inp = readln().split(" ")
val a = inp[0].toInt()
val b = inp[1].toInt()
val sum = a + b
println(sum)
}
Information
- ID
- 1000
- Difficulty
- 1
- Category
- Beginners Click to Show
- Tags
- (None)
- # Submissions
- 803
- Accepted
- 772
- Accepted Ratio
- 96%
- Uploaded By
Related
In following contests: