Welcome to the DMOJ!
In this task, you must print out the message Hello, World!
— the judge is very strict, so you must output it with the same capitalization and punctuation.
Some example solutions in a couple of languages are shown below. After you've gotten the hang of submitting, try out a harder problem like A Plus B.
Python 2/3
print("Hello, World!")
Java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
C++
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
return 0;
}
C
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
Pascal
program helloworld;
begin
writeln('Hello, World!');
end.
JavaScript (Node.js)
console.log('Hello, World!');
JavaScript (V8)
print('Hello, World!');
Turing
put "Hello, World!"
Algol 68
print(("Hello, World!", newline))
Haskell
main = putStrLn "Hello, World!"
Perl
print "Hello, World!\n";
PHP
<?php
echo "Hello, World!\n";
?>
C#
using System;
class HelloWorld {
public static void Main(string[] args) {
Console.WriteLine("Hello, World!");
}
}
D
import std.stdio;
void main() {
writeln("Hello, World!");
}
Go
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
Scala
object helloworld extends App {
println("Hello, World!")
}
Swift
print("Hello, World!")
Kotlin
fun main(args: Array<String>) {
print("Hello, World!")
}
Racket
#lang racket
(displayln "Hello, World!")
Ruby
puts 'Hello, World!'
Rust
fn main() {
println!("Hello, World!");
}
OCaml
print_string "Hello, World!\n";
NASM x86
section .text
global _start
_start:
mov eax, 4
xor ebx, ebx
inc ebx
mov ecx, msg
mov edx, len
int 80h
xor eax, eax
inc eax
xor ebx, ebx
int 80h
section .data
msg db "Hello, World!", 0xA
len equ $ - msg
Comments
I'm testing my magical NASMx64 code that I got from one of the best solutions,but I kept getting RTE for "alarm syscall disallowed".
I love
Hello world
print("Hello, World!") that simple
This comment is hidden due to too much negative feedback. Show it anyway.
this is must be known as the beginner question
This comment is hidden due to too much negative feedback. Show it anyway.
how on dmoj...
how
How
Here is a solution in llvm-ir
Instructions unclear. I hacked into NASA
This comment is hidden due to too much negative feedback. Show it anyway.
Dang did you see plans on going to Mars?
devnarula ORZZZZZZZZZ
Hello, World!
Please refrain from putting problem solutions in the comments.
Languages that I can't AC in:
Groovy has an actual AC submission but not a single AC for Sed.
BrainF Answer
Shorter BF solution
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
Please note that comments are not for extended discussion.
The DMOJ Discord Server exists for this purpose, and should be used if you want to ask questions or otherwise make comments that are unlikely to benefit other readers. This includes discussing problem spoilers or requests to debug code.
Violation of this may result in your comments being removed. Repeat offenders may be muted.
There's me with assembly trying every bit of performance voodoo magic known to man. And then there's that guy with python2 four places above me who simply did "print 'Hello, World!'". Then comes the depressing realization that I literally spent more than two hours on a hello world program...
Look on the bright side. You just made hello world run in only 4 kilobytes.
This comment is hidden due to too much negative feedback. Show it anyway.
The best submissions does this already. Besides, it is trivially doable in some languages, most notably assembly.
This is too challenging for most people. It's unreasonable to think you can keep the memory under 64M. Petition to remove this problem from the Internet.
This comment is hidden due to too much negative feedback. Show it anyway.
After carefully rereading the problem's requirements over and over again, I have concluded that you are in fact correct. I will gladly sign such a petition, if only to ease the pain one must suffer staying up long nights trying to complete this unfeasible project. My sentiments out to all families who have fallen victim to this terrible request.
Obviously, unless you've taken some abstract algebra recently, you will be totally at a loss.