본문 바로가기
ALGORITHM

백준 언어별 파일 입출력

by Z@__ 2021. 4. 28.
반응형

Java 8

  • 언어 번호: 3
  • 컴파일: javac -J-Xms1024m -J-Xmx1920m -J-Xss512m -encoding UTF-8 Main.java
  • 실행: java -Xms1024m -Xmx1920m -Xss512m -Dfile.encoding=UTF-8 Main
  • 버전: Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
  • 시간 제한: ×2+1 초
  • 메모리 제한: ×2+16 MB
  • 1000번 예제 소스 코드

 

 

 

1

import java.util.*;

2

public class Main{

3

public static void main(String args[]){

4

Scanner sc = new Scanner(System.in);

5

int a, b;

6

a = sc.nextInt();

7

b = sc.nextInt();

8

System.out.println(a + b);

9

}

10

}

11

C++17

  • 언어 번호: 84
  • 컴파일: g++ Main.cc -o Main -O2 -Wall -lm -static -std=gnu++17 -DONLINE_JUDGE -DBOJ
  • 실행: ./Main
  • 버전: g++ (GCC) 10.2.0
  • 1000번 예제 소스 코드

 

 

 

1

#include <iostream>

2

using namespace std;

3

int main() {

4

int a, b;

5

cin >> a >> b;

6

cout << a+b << endl;

7

return 0;

8

}

9

 

Python 3

  • 언어 번호: 28
  • 컴파일: python3 -c "import py_compile; py_compile.compile(r'Main.py')"
  • 실행: python3 Main.py
  • 버전: Python 3.9.0
  • 시간 제한: ×3+2 초
  • 메모리 제한: ×2+32 MB
  • 1000번 예제 소스 코드

 

 

 

1

a, b = map(int, input().split())

2

print(a+b)

3

 

PyPy3

 

 

 

1

a, b = map(int, input().split())

2

print(a+b)

3

 

C99

  • 언어 번호: 0
  • 컴파일: gcc Main.c -o Main -O2 -Wall -lm -static -std=gnu99 -DONLINE_JUDGE -DBOJ
  • 실행: ./Main
  • 버전: gcc (GCC) 10.2.0
  • 1000번 예제 소스 코드

 

 

 

1

#include <stdio.h>

2

int main() {

3

int a, b;

4

scanf("%d %d",&a,&b);

5

printf("%d\n",a+b);

6

return 0;

7

}

8

 

Java 11

  • 언어 번호: 93
  • 컴파일: javac -release 11 -J-Xms1024m -J-Xmx1920m -J-Xss512m -encoding UTF-8 Main.java
  • 실행: java -Xms1024m -Xmx1920m -Xss512m -Dfile.encoding=UTF-8 -XX:+UseSerialGC -DONLINE_JUDGE=1 -DBOJ=1 Main
  • 버전: openjdk 15 2020-09-15
  • 시간 제한: ×2+1 초
  • 메모리 제한: ×2+16 MB
  • 1000번 예제 소스 코드

 

 

 

1

import java.util.*;

2

public class Main{

3

public static void main(String args[]){

4

Scanner sc = new Scanner(System.in);

5

int a, b;

6

a = sc.nextInt();

7

b = sc.nextInt();

8

System.out.println(a + b);

9

}

10

}

11

 

Ruby 2.7

 

 

 

1

a, b = gets.split

2

puts a.to_i + b.to_i

3

 

Kotlin (JVM)

  • 언어 번호: 69
  • 컴파일: kotlinc-jvm -J-Xms1024m -J-Xmx1920m -J-Xss512m -include-runtime -d Main.jar Main.kt
  • 실행: java -Xms1024m -Xmx1920m -Xss512m -Dfile.encoding=UTF-8 -XX:+UseSerialGC -DONLINE_JUDGE=1 -DBOJ=1 -jar Main.jar
  • 버전: kotlinc-jvm 1.4.21 (JRE 1.8.0_201-b09)
  • 런타임: Java 8
  • 시간 제한: ×2+1 초
  • 메모리 제한: ×2+16 MB
  • 1000번 예제 소스 코드

 

 

 

1

import java.util.Scanner

2

3

fun main(args: Array<String>) {

4

val sc: Scanner = Scanner(System.`in`)

5

var a = sc.nextInt()

6

var b = sc.nextInt()

7

println(a+b)

8

}

 

Swift

 

 

 

1

import Foundation

2

let line = readLine()!

3

let lineArr = line.components(separatedBy: " ")

4

let a = Int(lineArr[0])!

5

let b = Int(lineArr[1])!

6

print(a+b)

 

Text

 

 

 

1

 

C# 9.0 (.NET)

  • 언어 번호: 86
  • 컴파일: dotnet new console --force -o Main && dotnet publish Main --configuration Release --self-contained true --runtime linux-x64
  • 실행: ./Main
  • 버전: 5.0.101
  • 시간 제한: ×2+1 초
  • 메모리 제한: ×2+16 MB
  • 1000번 예제 소스 코드

 

 

 

1

using System;

2

3

namespace Baekjoon {

4

class Program {

5

static void Main() {

6

string s = Console.ReadLine();

7

string[] ss = s.Split();

8

int a = int.Parse(ss[0]);

9

int b = int.Parse(ss[1]);

10

Console.WriteLine(a+b);

11

}

12

}

13

}

 

node.js

  • 언어 번호: 17
  • 실행: node Main.js
  • 버전: v14.15.0
  • 시간 제한: ×3+2 초
  • 메모리 제한: ×2 MB
  • 1000번 예제 소스 코드

 

 

 

1

var fs = require('fs');

2

var input = fs.readFileSync('/dev/stdin').toString().split(' ');

3

var a = parseInt(input[0]);

4

var b = parseInt(input[1]);

5

console.log(a+b);

6

 

Go

 

 

 

1

package main

2

3

import "fmt"

4

5

func main() {

6

var a, b int

7

fmt.Scanf("%d %d", &a, &b)

8

fmt.Printf("%d\n", a+b)

9

}

10

 

D

  • 언어 번호: 29
  • 컴파일: dmd -boundscheck=off -O -of=Main -fPIC -inline -release Main.d
  • 실행: ./Main
  • 버전: DMD64 D Compiler v2.095.0
  • 메모리 제한: +16 MB
  • 1000번 예제 소스 코드

 

 

 

1

import std.stdio;

2

import std.conv;

3

import std.string;

4

5

void main() {

6

string[] r;

7

try

8

r = readln().split();

9

catch (StdioException e)

10

r = ["0", "0"];

11

auto a = to!int(r[0]);

12

auto b = to!int(r[1]);

13

auto ans = a + b;

14

writeln(ans);

15

}

16

 

Rust 2018

 

 

 

1

use std::io;

2

3

fn main() {

4

let mut s = String::new();

5

6

io::stdin().read_line(&mut s).unwrap();

7

8

let values:Vec<i32> = s

9

.as_mut_str()

10

.split_whitespace()

11

.map(|s| s.parse().unwrap())

12

.collect();

13

14

println!("{}", values[0] + values[1]);

15

}

 

C++17 (Clang)

 

 

 

1

#include <iostream>

2

using namespace std;

3

int main() {

4

int a, b;

5

cin >> a >> b;

6

cout << a+b << endl;

7

return 0;

8

}

9

 

C11

  • 언어 번호: 75
  • 컴파일: gcc Main.c -o Main -O2 -Wall -lm -static -std=gnu11 -DONLINE_JUDGE -DBOJ
  • 실행: ./Main
  • 버전: gcc (GCC) 10.2.0
  • 1000번 예제 소스 코드

 

 

 

1

#include <stdio.h>

2

int main() {

3

int a, b;

4

scanf("%d %d",&a,&b);

5

printf("%d\n",a+b);

6

return 0;

7

}

8

 

C++98

  • 언어 번호: 1
  • 컴파일: g++ Main.cc -o Main -O2 -Wall -lm -static -std=gnu++98 -DONLINE_JUDGE -DBOJ
  • 실행: ./Main
  • 버전: g++ (GCC) 10.2.0
  • 1000번 예제 소스 코드

 

 

 

1

#include <iostream>

2

using namespace std;

3

int main() {

4

int a, b;

5

cin >> a >> b;

6

cout << a+b << endl;

7

return 0;

8

}

9

 

C++11

  • 언어 번호: 49
  • 컴파일: g++ Main.cc -o Main -O2 -Wall -lm -static -std=gnu++11 -DONLINE_JUDGE -DBOJ
  • 실행: ./Main
  • 버전: g++ (GCC) 10.2.0
  • 1000번 예제 소스 코드

 

 

 

1

#include <iostream>

2

using namespace std;

3

int main() {

4

int a, b;

5

cin >> a >> b;

6

cout << a+b << endl;

7

return 0;

8

}

9

 

C++14

  • 언어 번호: 88
  • 컴파일: g++ Main.cc -o Main -O2 -Wall -lm -static -std=gnu++14 -DONLINE_JUDGE -DBOJ
  • 실행: ./Main
  • 버전: g++ (GCC) 10.2.0
  • 1000번 예제 소스 코드

 

 

 

1

#include <iostream>

2

using namespace std;

3

int main() {

4

int a, b;

5

cin >> a >> b;

6

cout << a+b << endl;

7

return 0;

8

}

9

 

Java 8 (OpenJDK)

  • 언어 번호: 91
  • 컴파일: javac -release 8 -J-Xms1024m -J-Xmx1920m -J-Xss512m -encoding UTF-8 Main.java
  • 실행: java -Xms1024m -Xmx1920m -Xss512m -Dfile.encoding=UTF-8 -XX:+UseSerialGC -DONLINE_JUDGE=1 -DBOJ=1 Main
  • 버전: openjdk 15 2020-09-15
  • 시간 제한: ×2+1 초
  • 메모리 제한: ×2+16 MB
  • 1000번 예제 소스 코드

 

 

 

1

import java.util.*;

2

public class Main{

3

public static void main(String args[]){

4

Scanner sc = new Scanner(System.in);

5

int a, b;

6

a = sc.nextInt();

7

b = sc.nextInt();

8

System.out.println(a + b);

9

}

10

}

11

 

C++20

  • 언어 번호: 95
  • 컴파일: g++ Main.cc -o Main -O2 -Wall -lm -static -std=gnu++20 -DONLINE_JUDGE -DBOJ
  • 실행: ./Main
  • 버전: g++ (GCC) 10.2.0
  • 1000번 예제 소스 코드

 

 

 

1

#include <iostream>

2

using namespace std;

3

int main() {

4

int a, b;

5

cin >> a >> b;

6

cout << a+b << endl;

7

return 0;

8

}

9

 

Python 2

  • 언어 번호: 6
  • 컴파일: python -c "import py_compile; py_compile.compile(r'Main.py')"
  • 실행: python Main.py
  • 버전: Python 2.7.18
  • 시간 제한: ×3+2 초
  • 메모리 제한: ×2+32 MB
  • 1000번 예제 소스 코드

 

 

 

1

a, b = map(int, raw_input().split())

2

print a+b

3

 

PyPy2

 

 

 

1

a, b = map(int, raw_input().split())

2

print a+b

3

 

Kotlin (Native)

 

 

 

1

fun main(args: Array<String>) {

2

var nums = readLine()!!.split(" ")

3

var a = nums[0].toInt()

4

var b = nums[1].toInt()

5

println(a+b)

6

}

 

Go (gccgo)

  • 언어 번호: 90
  • 컴파일: gccgo -O2 -o Main -static Main.go
  • 실행: ./Main
  • 버전: gccgo (GCC) 10.2.0
  • 1000번 예제 소스 코드

 

 

 

1

package main

2

3

import "fmt"

4

5

func main() {

6

var a, b int

7

fmt.Scanf("%d %d", &a, &b)

8

fmt.Printf("%d\n", a+b)

9

}

10

 

Java 15

  • 언어 번호: 107
  • 컴파일: javac -release 15 -J-Xms1024m -J-Xmx1920m -J-Xss512m -encoding UTF-8 Main.java
  • 실행: java -Xms1024m -Xmx1920m -Xss512m -Dfile.encoding=UTF-8 -XX:+UseSerialGC -DONLINE_JUDGE=1 -DBOJ=1 Main
  • 버전: openjdk 15 2020-09-15
  • 시간 제한: ×2+1 초
  • 메모리 제한: ×2+16 MB
  • 1000번 예제 소스 코드

 

 

 

1

import java.util.*;

2

public class Main{

3

public static void main(String args[]){

4

Scanner sc = new Scanner(System.in);

5

int a, b;

6

a = sc.nextInt();

7

b = sc.nextInt();

8

System.out.println(a + b);

9

}

10

}

11

 

D (LDC)

 

 

 

1

import std.stdio;

2

import std.conv;

3

import std.string;

4

5

void main() {

6

string[] r;

7

try

8

r = readln().split();

9

catch (StdioException e)

10

r = ["0", "0"];

11

auto a = to!int(r[0]);

12

auto b = to!int(r[1]);

13

auto ans = a + b;

14

writeln(ans);

15

}

16

 

PHP

  • 언어 번호: 7
  • 컴파일: php -l Main.php
  • 실행: php Main.php
  • 버전: PHP 7.4.4
  • 메모리 제한: +512 MB
  • 1000번 예제 소스 코드

 

 

 

1

<?php

2

fscanf(STDIN,"%d %d",$a,$b);

3

fprintf(STDOUT,"%d",$a+$b);

4

 

Rust 2015

 

 

 

1

use std::io;

2

3

fn main() {

4

let mut s = String::new();

5

6

io::stdin().read_line(&mut s).unwrap();

7

8

let values:Vec<i32> = s

9

.as_mut_str()

10

.split_whitespace()

11

.map(|s| s.parse().unwrap())

12

.collect();

13

14

println!("{}", values[0] + values[1]);

15

}

 

Pascal

 

 

 

1

program p1000(Input,Output);

2

var

3

a,b:Integer;

4

begin

5

Readln(a,b);

6

Writeln(a+b);

7

end.

8

 

Lua

 

 

 

1

a,b = io.read("*number", "*number")

2

print(a+b)

3

 

Perl

  • 언어 번호: 8
  • 컴파일: perl -c Main.pl
  • 실행: perl Main.pl
  • 버전: Perl v5.30.0
  • 메모리 제한: +512 MB
  • 1000번 예제 소스 코드

 

 

 

1

#!/usr/bin/perl

2

my $a = <STDIN>;

3

my @b = split(/ /, $a);

4

5

my $ans = @b[0] + @b[1];

6

7

print $ans;

8

 

R

 

 

 

1

fp=file("stdin", "r")

2

a=scan(file=fp, what=integer(0), n=1)

3

b=scan(file=fp, what=integer(0), n=1)

4

cat(a+b)

 

F# (.NET)

  • 언어 번호: 108
  • 컴파일: dotnet new console --language "F#" --force -o Main && dotnet publish Main --configuration Release --self-contained true --runtime linux-x64
  • 실행: ./Main
  • 버전: 5.0.101
  • 시간 제한: ×2+1 초
  • 메모리 제한: ×2+16 MB
  • 1000번 예제 소스 코드

 

 

 

1

open System

2

3

[<EntryPoint>]

4

let main argv =

5

let line = Console.ReadLine().Split()

6

let a = Convert.ToInt32(line.[0])

7

let b = Convert.ToInt32(line.[1])

8

printfn "%d" (a+b)

9

0

 

Visual Basic (.NET)

  • 언어 번호: 109
  • 컴파일: dotnet new console --language "VB" --force -o Main && dotnet publish Main --configuration Release --self-contained true --runtime linux-x64
  • 실행: ./Main
  • 버전: 5.0.101
  • 시간 제한: ×2+1 초
  • 메모리 제한: ×2+16 MB
  • 1000번 예제 소스 코드

 

 

 

1

Module Main

2

3

Sub Main()

4

Dim s() As String = Nothing

5

6

s = Console.ReadLine().Split(" "c)

7

Console.WriteLine(CInt(s(0)) + CInt(s(1)))

8

End Sub

9

10

End Module

11

 

Objective-C

 

 

 

1

#import <Foundation/Foundation.h>

2

3

int main (void)

4

{

5

NSInteger a,b;

6

scanf("%d %d",&a,&b);

7

printf("%d\n",a+b);

8

return 0;

9

}

10

 

Objective-C++

 

 

 

1

#import <Foundation/Foundation.h>

2

3

int main (void)

4

{

5

NSInteger a,b;

6

scanf("%d %d",&a,&b);

7

printf("%d\n",a+b);

8

return 0;

9

}

10

 

C99 (Clang)

 

 

 

1

#include <stdio.h>

2

int main() {

3

int a, b;

4

scanf("%d %d",&a,&b);

5

printf("%d\n",a+b);

6

return 0;

7

}

8

 

C++98 (Clang)

 

 

 

1

#include <iostream>

2

using namespace std;

3

int main() {

4

int a, b;

5

cin >> a >> b;

6

cout << a+b << endl;

7

return 0;

8

}

9

 

C++11 (Clang)

 

 

 

1

#include <iostream>

2

using namespace std;

3

int main() {

4

int a, b;

5

cin >> a >> b;

6

cout << a+b << endl;

7

return 0;

8

}

9

 

C++14 (Clang)

 

 

 

1

#include <iostream>

2

using namespace std;

3

int main() {

4

int a, b;

5

cin >> a >> b;

6

cout << a+b << endl;

7

return 0;

8

}

9

 

C11 (Clang)

 

 

 

1

#include <stdio.h>

2

int main() {

3

int a, b;

4

scanf("%d %d",&a,&b);

5

printf("%d\n",a+b);

6

return 0;

7

}

8

 

C++20 (Clang)

 

 

 

1

#include <iostream>

2

using namespace std;

3

int main() {

4

int a, b;

5

cin >> a >> b;

6

cout << a+b << endl;

7

return 0;

8

}

9

 

Golfscript

 

 

 

1

~+

 

C90

  • 언어 번호: 101
  • 컴파일: gcc Main.c -o Main -O2 -Wall -lm -static -std=gnu90 -DONLINE_JUDGE -DBOJ
  • 실행: ./Main
  • 버전: gcc (GCC) 10.2.0
  • 1000번 예제 소스 코드

 

 

 

1

#include <stdio.h>

2

int main() {

3

int a, b;

4

scanf("%d %d",&a,&b);

5

printf("%d\n",a+b);

6

return 0;

7

}

8

 

C2x

  • 언어 번호: 102
  • 컴파일: gcc Main.c -o Main -O2 -Wall -lm -static -std=gnu2x -DONLINE_JUDGE -DBOJ
  • 실행: ./Main
  • 버전: gcc (GCC) 10.2.0
  • 1000번 예제 소스 코드

 

 

 

1

#include <stdio.h>

2

int main() {

3

int a, b;

4

scanf("%d %d",&a,&b);

5

printf("%d\n",a+b);

6

return 0;

7

}

8

 

C90 (Clang)

 

 

 

1

#include <stdio.h>

2

int main() {

3

int a, b;

4

scanf("%d %d",&a,&b);

5

printf("%d\n",a+b);

6

return 0;

7

}

8

 

C2x (Clang)

 

 

 

1

#include <stdio.h>

2

int main() {

3

int a, b;

4

scanf("%d %d",&a,&b);

5

printf("%d\n",a+b);

6

return 0;

7

}

8

 

TypeScript

  • 언어 번호: 106
  • 컴파일: tsc Main.ts
  • 실행: node Main.js
  • 버전: Version 4.0.3
  • 런타임: node.js
  • 시간 제한: ×3+2 초
  • 메모리 제한: ×2 MB
  • 1000번 예제 소스 코드

 

 

 

1

import fs = require('fs')

2

var input = fs.readFileSync('/dev/stdin').toString().split(' ');

3

var a = parseInt(input[0]);

4

var b = parseInt(input[1]);

5

console.log(a+b);

 

Assembly (32bit)

  • 언어 번호: 27
  • 컴파일: nasm -f elf32 -o Main.o Main.asm && gcc -m32 -o Main Main.o
  • 실행: ./Main
  • 버전: NASM version 2.15.05
  • 1000번 예제 소스 코드

 

 

 

1

section .data

2

input: db "%d %d",0

3

output: db "%d",10,0

4

5

a: times 4 db 0

6

b: times 4 db 0

7

8

section .text

9

global main

10

extern scanf

11

extern printf

12

13

main:

14

push ebx

15

push ecx

16

17

push b

18

push a

19

push input

20

call scanf

21

add esp, 12

22

23

mov ebx, dword[a]

24

mov ecx, dword[b]

25

add ebx, ecx

26

27

push ebx

28

push output

29

call printf

30

add esp, 8

31

pop ecx

32

pop ebx

33

mov eax,0

34

ret

35

 

Assembly (64bit)

  • 언어 번호: 87
  • 컴파일: nasm -f elf64 -o Main.o Main.asm && gcc -o Main Main.o
  • 실행: ./Main
  • 버전: NASM version 2.15.05
  • 1000번 예제 소스 코드

 

 

 

1

section .data

2

input: db "%d %d",0

3

output: db "%d",10,0

4

5

a: times 4 db 0

6

b: times 4 db 0

7

8

section .text

9

global main

10

extern scanf

11

extern printf

12

13

main:

14

push rbp

15

16

mov rdi, input

17

lea rsi, [a]

18

lea rdx, [b]

19

mov rax, 0

20

call scanf

21

22

mov rax, [a]

23

mov rbx, [b]

24

add rax, rbx

25

26

mov rdi, output

27

mov rsi, rax

28

mov rax, 0

29

call printf

30

31

pop rbp

32

mov rax,0

33

ret

 

Bash

 

 

 

1

read a b

2

echo $(($a+$b))

3

 

Fortran

  • 언어 번호: 13
  • 컴파일: gfortran Main.f95 -o Main -O2 -Wall -fmax-array-constructor=2097152 -static
  • 실행: ./Main
  • 버전: GNU Fortran (GCC) 10.2.0
  • 메모리 제한: +16 MB
  • 1000번 예제 소스 코드

 

 

 

1

PROGRAM P1000

2

3

IMPLICIT NONE

4

INTEGER :: A, B

5

6

READ(*,*) A, B

7

WRITE(*, '(I0)') A + B

8

9

END PROGRAM P1000

10

 

Scheme

  • 언어 번호: 14
  • 컴파일: csc -output-file Main -O5 Main.scm
  • 실행: ./Main
  • 버전: Version 5.2.0 (rev 317468e4)
  • 시간 제한: ×2+1 초
  • 메모리 제한: ×2+16 MB
  • 1000번 예제 소스 코드

 

 

 

1

(write (+ (read) (read)))

 

Ada

  • 언어 번호: 19
  • 컴파일: gnatmake -O2 -o Main Main.ada
  • 실행: ./Main
  • 버전: GNATMAKE 10.2.0
  • 1000번 예제 소스 코드

 

 

 

1

with Ada.Integer_Text_Io;

2

procedure Main is

3

A, B : Integer;

4

begin

5

Ada.Integer_Text_Io.Get (Item => A);

6

Ada.Integer_Text_Io.Get (Item => B);

7

Ada.Integer_Text_Io.Put (A+B, Width=>1, Base=>10);

8

end Main;

9

 

awk

 

 

 

1

{ print $1 + $2 }

2

 

OCaml

 

 

 

1

Scanf.scanf "%d %d" (fun a b -> Printf.printf "%d\n" (a + b))

2

 

Brainf**k

  • 언어 번호: 23
  • 컴파일: ./bfi -c Main.bf && gcc Main.c -o Main -O2 -Wall -lm -static -std=c11 -DONLINE_JUDGE -DBOJ
  • 실행: ./Main
  • 버전: bfi: Version 1.1.0 dabe513 on Linux x64
  • 시간 제한: +1 초
  • 예제 소스 작성: xhark
  • 1000번 예제 소스 코드

 

 

 

1

>>>>><<+>>,>,,>

2

++++++[<-------->-]

3

++++++[<<-------->>-]

4

<<[>+<-]>>

5

++++++++++[-<[->>]<]

6

<<[++++++++>>>>[<<<<->>>>-]<<<<<++++++[>++++++++<-]>.<]

7

<<[<++++++[>++++++++<-]>.>>><++++++[>++++++++<-]>.>]

8

 

Whitespace

  • 언어 번호: 24
  • 실행: whitespace Main.ws
  • 버전: Whitespace
  • 예제 소스 작성: xhark
  • 1000번 예제 소스 코드

 

 

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

 

Tcl

  • 언어 번호: 26
  • 실행: tclsh Main.tcl
  • 버전: 8.6
  • 메모리 제한: +512 MB
  • 1000번 예제 소스 코드

 

 

 

1

scan [gets stdin] "%d %d" x y

2

puts [expr {$x + $y}]

3

 

Rhino

  • 언어 번호: 34
  • 실행: java -Xms1024m -Xmx1920m -Xss512m -Dfile.encoding=UTF-8 -jar rhino.jar Main.js
  • 버전: Rhino 1.7.13
  • 런타임: Java 8
  • 시간 제한: ×2+1 초
  • 메모리 제한: ×2+16 MB
  • 1000번 예제 소스 코드

 

 

 

1

importPackage(java.util);

2

importPackage(java.lang);

3

(function(){

4

var sc = new Scanner(System['in']);

5

var a = sc.nextInt();

6

var b = sc.nextInt();

7

print(a+b);

8

})();

9

 

Cobol

 

 

 

1

IDENTIFICATION DIVISION.

2

PROGRAM-ID. Main.

3

4

DATA DIVISION.

5

WORKING-STORAGE SECTION.

6

01 A PIC 9(1).

7

01 B PIC 9(1).

8

01 C1 PIC 9(1).

9

01 C2 PIC 9(2).

10

11

PROCEDURE DIVISION.

12

Begin.

13

ACCEPT A

14

ACCEPT B

15

16

ADD A B GIVING C1

17

ADD A B GIVING C2

18

19

IF C2 <= 9 then

20

DISPLAY C1

21

ELSE

22

DISPLAY C2

23

END-IF

24

25

STOP RUN.

 

Pike

 

 

 

1

int main() {

2

string line = Stdio.stdin->gets();

3

sscanf(line, "%d %d", int a, int b);

4

write(a+b +"\n");

5

return 0;

6

}

7

 

sed

  • 언어 번호: 43
  • 컴파일: fromdos Main.sed
  • 실행: sed -f Main.sed
  • 버전: sed (GNU sed) 4.8
  • 1000번 예제 소스 코드

 

 

 

1

: Loop

2

/^-*00* /s///

3

/ -*00*$/s///

4

t

5

s/\(.[0-9]*\) \(.[0-9]*\)/\1;987654321000009999000999009909 \2;012345678999990000999000990090/

6

s/ \(-\)*\(9*;\)/ \10\2/

7

s/\([^0]\)\(0*\);[^0]*\1\(.\).*\2\(9*\).* \(.*\)/\3\4 \5/

8

s/\([^9]\)\(9*\);[^9]*\1\(.\).*\2\(0*\).*/\3\4/

9

t Loop

10

 

Boo

 

 

 

1

import System

2

a=Console.ReadLine().Split()

3

print int.Parse(a[0])+int.Parse(a[1])

4

 

INTERCAL

 

 

 

1

생략

 

bc

  • 언어 번호: 48
  • 컴파일: from Main.bc
  • 실행: bc -q Main.bc
  • 버전: bc 1.07.1
  • 1000번 예제 소스 코드

 

 

 

1

a=read()

2

b=read()

3

print a+b

4

 

Algol 68

  • 언어 번호: 70
  • 컴파일: a68g --check Main.a68
  • 실행: a68g Main.a68
  • 버전: Algol 68 Genie 2.8
  • 1000번 예제 소스 코드

 

 

 

1

INT sum;

2

sum:=read int + read int;

3

4

IF sum < 10 THEN

5

printf(($dl$,sum))

6

ELSE

7

printf(($2dl$,sum))

8

FI

 

Befunge

  • 언어 번호: 71
  • 실행: cfunge Main.bf
  • 버전: cfunge 0.9.0
  • 메모리 제한: +32 MB
  • 1000번 예제 소스 코드

 

 

 

1

&&+.@

 

FreeBASIC

 

 

 

1

Dim a As Integer

2

Dim b As Integer

3

4

Open Cons For Input As #1

5

Input #1, a, b

6

Print Str(a+b)

 

Haxe

  • 언어 번호: 81
  • 컴파일: haxe -main Main -python Main.py
  • 실행: python3 Main.py
  • 버전: Haxe 4.1.4
  • 런타임: Python 3
  • 시간 제한: ×3+2 초
  • 메모리 제한: ×2+32 MB
  • 1000번 예제 소스 코드

 

 

 

1

class Main {

2

static public function main():Void {

3

var a = Sys.stdin().readLine().split(" ").map(Std.parseInt);

4

trace(a[0]+a[1]);

5

}

6

}

 

LOLCODE

  • 언어 번호: 82
  • 실행: lci Main.lol
  • 버전: lci v0.11.2
  • 2558번 예제 소스 코드

 

 

 

1

HAI 1.4

2

CAN HAS STDIO?

3

I HAS A a

4

I HAS A b

5

GIMMEH a

6

GIMMEH b

7

VISIBLE SUM OF a AN b

8

KTHXBYE

9

 

아희

 

 

 

1

방방다망함ㅋㅋㅋ

2

 

SystemVerilog

 

 

 

1

module main;

2

logic[3:0] a, b;

3

logic[4:0] c;

4

5

adder adder(.a, .b, .c);

6

7

initial begin

8

integer code;

9

code = $fscanf(32'h8000_0000, "%d %d", a, b);

10

#1 $display("%0d", c);

11

$finish;

12

end

13

endmodule

14

15

module adder(

16

input logic[3:0] a,

17

input logic[3:0] b,

18

output logic[4:0] c

19

);

20

assign c = a + b;

21

endmodule

22

 

F# (Mono)

 

 

 

 

1

open System

2

let plus = (fun (a:string) (b:string) -> Console.WriteLine(int(a)+int(b))) (Console.ReadLine()) (Console.ReadLine());

3

 

Raku

 

 

 

1

say [+] .words for lines

2

 

Ruby 1.8

 

 

 

1

a, b = gets.split

2

puts a.to_i + b.to_i

3

 

Ruby 1.9

 

 

 

1

a, b = gets.split

2

puts a.to_i + b.to_i

3

 

Haskell

 

 

 

1

main = print . sum . map read . words =<< getLine

 

C# 6.0 (Mono)

  • 언어 번호: 62
  • 컴파일: mcs -codepage:utf8 -warn:0 -optimize+ -checked+ -clscheck- -reference:System.Numerics.dll -out:Main.exe Main.cs
  • 실행: mono --optimize=all Main.exe
  • 버전: Mono C# compiler version 6.12.0.107
  • 시간 제한: ×2+1 초
  • 메모리 제한: ×2+16 MB
  • 1000번 예제 소스 코드

 

 

 

1

using System;

2

3

public class Program {

4

public static void Main() {

5

string s = Console.ReadLine();

6

string[] ss = s.Split();

7

int a = int.Parse(ss[0]);

8

int b = int.Parse(ss[1]);

9

Console.WriteLine(a+b);

10

}

11

}

12

 

C# 3.0 (Mono)

  • 언어 번호: 9
  • 컴파일: mcs -langversion:3 -codepage:utf8 -warn:0 -optimize+ -checked+ -clscheck- -out:Main.exe Main.cs
  • 실행: mono --optimize=all Main.exe
  • 버전: Mono C# compiler version 6.12.0.107
  • 1000번 예제 소스 코드

 

 

 

1

using System;

2

3

public class Program {

4

public static void Main() {

5

string s = Console.ReadLine();

6

string[] ss = s.Split();

7

int a = int.Parse(ss[0]);

8

int b = int.Parse(ss[1]);

9

Console.WriteLine(a+b);

10

}

11

}

12

 

VB.NET 2.0 (Mono)

 

 

 

1

Module Main

2

3

Sub Main()

4

Dim s() As String = Nothing

5

6

s = Console.ReadLine().Split(" "c)

7

Console.WriteLine(CInt(s(0)) + CInt(s(1)))

8

End Sub

9

10

End Module

11

 

VB.NET 4.0 (Mono)

 

 

 

1

Module Main

2

3

Sub Main()

4

Dim s() As String = Nothing

5

6

s = Console.ReadLine().Split(" "c)

7

Console.WriteLine(CInt(s(0)) + CInt(s(1)))

8

End Sub

9

10

End Module

11

 

Dart

 

 

 

1

import 'dart:io';

2

main() {

3

String line = stdin.readLineSync();

4

var arr = line.split(new RegExp(r'[ ]+'));

5

var a = int.parse(arr[0]);

6

var b = int.parse(arr[1]);

7

print(a+b);

8

}

 

Nemerle

 

 

 

1

using System;

2

using System.Console;

3

4

module Main

5

{

6

Main() : void

7

{

8

def a = ReadLine().Split();

9

WriteLine(int.Parse(a[0])+int.Parse(a[1]));

10

}

11

}

12

 

Cobra

 

 

 

1

class Sample

2

3

def main

4

input = Console.readLine.split

5

print int.parse(input[0]) + int.parse(input[1])

6

 

Nimrod

 

 

 

1

import strutils

2

3

var a = 0

4

5

for num in split(readLine(stdin)):

6

a += parseInt(num)

7

8

echo a

 

Coq

Minecraft

  • 언어 번호: 99
  • 컴파일: mc-compile Main.mca lime light_blue
  • 실행: mc-run Main
  • 버전: Minecraft

APECODE

  • 언어 번호: 110
  • 컴파일: apecc Main.ape
  • 실행: ./Main
  • 버전: APECODE

 

www.acmicpc.net/help/language/all

 

언어 도움말

section .data input: db "%d %d",0 output: db "%d",10,0 a: times 4 db 0 b: times 4 db 0 section .text global main extern scanf extern printf main: push rbp mov rdi, input lea rsi, [a] lea rdx, [b] mov rax, 0 call scanf mov rax, [a] mov rbx, [b] add rax, rbx

www.acmicpc.net

 

 

 

반응형

댓글