A + B
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
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)
}
Test
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 1
- Start at
- 2023-11-23 03:30
- End at
- 2023-11-23 06:30
- Duration
- 3.0 hour(s)
- Host
- Partic.
- 3