Topic | Users | Replies | Views | Activity |
---|---|---|---|---|
Solution to TEST in Perl 6
while (($_ = $*IN.get) != 42) { say $_; }
|
![]() ![]() |
1 | 1.1k | Aug '18 |
Solution to TEST in Perl
print while($_=<>)!=42
Any golfers want to show me how it's really done?
|
![]() ![]() ![]() ![]() ![]() |
6 | 1.5k | Sep '16 |
Solution to TEST in Ada95
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure test is
x : integer;
begin
loop
get(x);
if x/=42
then
put(x);
new_line(1);
else
…
read more
|
![]() ![]() ![]() ![]() ![]() |
7 | 1.5k | Jun '15 |
Solution to TEST in Brainf**k
+[>>----------
[++++++++++<,----------]
>--------------------------------------------------
>----------------------------------------------------
>
[
<++++++++++++++++++++++++++++++++++++++++++++++++++++
<++++++++++++++…
read more
|
![]() ![]() ![]() ![]() ![]() |
4 | 1.5k | Mar '15 |
Solution to TEST in Awk
{
if($0 != "42")
print $0
else
exit
}
And another alternative solution:
/42/{exit}
{print $0}
|
![]() ![]() ![]() ![]() ![]() |
5 | 1.3k | Jul '14 |
Solution to TEST in PHP
<?php
$stdin = fopen('php://stdin', 'r');
while (true) {
$input = fgets($stdin, 3);
if ($input == 42) {
break;
} else {
echo $input;
}
}
fclose($stdin);
?>
|
![]() ![]() ![]() ![]() ![]() |
10 | 2.9k | Mar '13 |
Solution to TEST in Ruby
while (l = gets.chomp.to_i) != 42
puts l
end
|
![]() ![]() ![]() ![]() |
3 | 1.4k | Dec '11 |
C# Input Method
I've noticed an influx of C# coders around here. I don't use the language much anymore for the more difficult problems because the I/O was so slow. The most difficult part to get around was that the input wasn't always…
read more
|
![]() |
0 | 1.7k | Apr '11 |
Solution to Test in Go
ideone.com/FfZ2v
package main
import (
"fmt"
)
func main() {
number:=0
fmt.Scanln(&number)
for number!= 42 {
fmt.Println(number)
fmt.Scanln(&number)
}
}
|
![]() |
0 | 1.1k | Jul '10 |
Solution to TEST in Tcl
while {1} {
gets stdin x
if {$x == 42} break
puts "$x\n"
}
exit 0
|
![]() |
0 | 962 | Sep '09 |
Solution to TEST in C#
using System;
public class Test
{
public static void Main()
{
int n;
while ((n = int.Parse(Console.ReadLine()))!=42)
Console.WriteLine(n);
}
}
|
![]() ![]() ![]() |
2 | 2.0k | Dec '08 |
Solution to TEST in Pike
int main() {
while (sscanf(Stdio.stdin->gets(), "%d", int n), n!=42 && write(n+"\n"));
return 0;
}
|
![]() |
0 | 985 | Dec '06 |
Solution to TEST in Intercal
PLEASE DO ,1 <- #1
PLEASE DO .4 <- #0
PLEASE DO .5 <- #0
PLEASE DO .99 <- #0
DO COME FROM (30)
DO COME FROM (31)
DO WRITE IN ,1
DO .1 <- ,1SUB#1
DO .2 <- .4
DO (1000) NEXT
DO .4 <- .3~#255
DO (10) NEXT
(42) …
read more
|
![]() |
0 | 987 | Aug '06 |
Solution to TEST in NASM
section .bss
buffer resb 1
section .text
global _start
_start:
call ReadChar
cmp al, '4'
jne wait_enter
; we've got '4'
…
read more
|
![]() ![]() |
1 | 1.5k | Jun '05 |
Solution to TEST in Bash
while read a; do
if [ $a -eq 42 ]; then
exit
else
echo $a
fi
done
|
![]() |
0 | 1.1k | Sep '04 |
Solution to TEST in Smalltalk
|c number|
[
number:=0.
[ (c := stdin next) asciiValue ~= 10 ]
whileTrue:
[number := (number * 10) + (c asciiValue) - 48.].
number ~= 42
]
whileTrue:
[Transcript show: number printString; cr.]
!
|
![]() |
0 | 992 | Jun '04 |
Solution to TEST in Fortran
program TEST
integer ans
do
read (*,*) ans
if (ans.eq.42) stop
write (*,*) ans
enddo
…
read more
|
![]() |
0 | 1.0k | Jun '04 |
Solution to TEST in Whitespace
Only white spaces are relevant in the code below. [wink]
CodeStartsHere:label
2
push 0
read
push 0
retrieve push 42
sub dup
jz
1
push 42
add print
pus…
read more
|
![]() |
0 | 1.1k | Jun '04 |
Solution to TEST in Icon
procedure main ()
while (l := read()) ~= 42 do
write(l);
end
|
![]() |
0 | 1.0k | Jun '04 |
About the Other languages category
Discussion on other languages and problems with all other SPOJ compilers
|
![]() |
0 | 1.1k | Jun '04 |
Julia on SPOJ |
![]() ![]() ![]() ![]() ![]() |
7 | 1.6k | Feb '23 |
C# compiled in Debug Mode |
![]() |
0 | 325 | Feb '23 |
Memory Management in PHP |
![]() ![]() |
2 | 980 | Nov '22 |
Forth |
![]() ![]() ![]() |
7 | 707 | Sep '22 |
BEADS - Glass Beads in PHP |
![]() ![]() |
2 | 429 | Aug '22 |
How to accept input from Online Judge in JavaScript? |
![]() ![]() |
1 | 540 | Aug '22 |
Problems(Questions) in BrainF**k |
![]() ![]() ![]() ![]() ![]() |
6 | 1.1k | May '22 |
C# gmcs 5.20 seems to be 2X slow |
![]() |
1 | 476 | Dec '21 |
Update DMD compiler |
![]() ![]() ![]() ![]() |
3 | 944 | Oct '21 |
Factor |
![]() |
0 | 465 | Feb '21 |