FAQs EXAMPLES

Have any doubts about the URI Online Judge? Here you can find the answers!

  • 1001 in C

    #include <stdio.h>
     
    int main() { 
        int A, B, X;
    
        scanf("%d", &A);
        scanf("%d", &B);
    
        X=A+B;
    
        printf("X = %d\n", X);
    
        return 0;
    }
    
  • 1001 in C++

    #include <iostream>
    
    using namespace std;
    
    int main() {
       int A, B, X;
    
       cin >> A >> B;
       X = A + B;
       cout << "X = " << X << endl;
    
       return 0;
    }
    
  • 1001 in C#

    using System; 
     
    class URI {
     
        static void Main(string[] args) { 
            int A = Int32.Parse( System.Console.ReadLine().Trim());
            int B = Int32.Parse( System.Console.ReadLine().Trim());
     
            int X = A + B;
     
            Console.Write("X = {0}\n", X);
        }
         
    }
    
  • 1001 in Java

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    
    public class Main {
        
        public static void main(String[] args) throws IOException {
            
            InputStreamReader ir = new InputStreamReader(System.in);
            BufferedReader in = new BufferedReader(ir);
            
            int A, B, X;
            
            A = Integer.parseInt(in.readLine());
            B = Integer.parseInt(in.readLine());
            
            X = A + B;
            
            System.out.printf("X = %d\n", X);
            
        }
        
    }
    
  • 1001 in Python

    a = input()
    b = input()
    
    X = a + b
    
    print "X = %i" % X
    
  • 1001 in Ruby

    a = gets.to_i 
    b = gets.to_i
    
    X = a + b
    
    puts "X = #{X}"
    
  • 1001 in Scala

    object Main {
        def main(args: Array[String]) {
            val A = io.StdIn.readLine().toInt
            val B = io.StdIn.readLine().toInt
          
            println("X = " + (A + B))
        }
    }
    
  • 1001 in Go

    package main
     
    import (
        "fmt"
    )
     
    func main() {
        var a,b int
        var x int
     
        fmt.Scanf("%d", &a)
        fmt.Scanf("%d", &b)
        x = a + b
         
        fmt.Printf("X = %d\n", x)
    }
    
  • 1001 in Kotlin

    import java.util.*
    
    fun main(args: Array) {
        val sc = Scanner(System.`in`);
        
        val a: String = sc.next();
        val b: String = sc.next();
        
        println("X = " + (a.toInt() + b.toInt()));
    }
    
  • 1001 in JavaScript

    var input = require('fs').readFileSync('/dev/stdin', 'utf8');
    var lines = input.split('\n');
        
    var a = parseInt(lines.shift());
    var b = parseInt(lines.shift());
       
    console.log('X = ' + (a+b));