Created
November 8, 2009 17:53
-
-
Save jlfwong/229406 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TEST AC - CPP (g++) | |
#include <iostream> | |
using namespace std; | |
int main() { | |
int n; | |
while(1) { | |
cin >> n; | |
if (n == 42) break; | |
cout << n << endl; | |
} | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#TEST AC - Perl | |
while (1) | |
{ | |
$n = <STDIN>; | |
if ($n == 42) { | |
last; | |
} | |
print $n | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# TEST AC - BASH | |
while true; do | |
read n | |
if [ $n -eq 42 ]; then | |
break | |
fi | |
echo "$n" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{TEST AC - GPC Pascal} | |
program TEST; | |
var n:integer; | |
begin | |
while true do | |
begin | |
readln(n); | |
if n = 42 then begin | |
break; | |
end; | |
writeln(n); | |
end; | |
end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TEST AC - (gcc C99) | |
#include <stdio.h> | |
int main() { | |
int n; | |
while(1) { | |
scanf("%d",&n); | |
if (n == 42) break; | |
printf("%d\n",n); | |
} | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//TEST AC - PHP | |
while(1) { | |
fscanf(STDIN,"%d",$n); | |
if ($n == 42) break; | |
print "$n\n"; | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#TEST AC - Python | |
while 1: | |
num = input() | |
if (num == 42): | |
break | |
print num |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#TEST AC - Ruby | |
while 1 | |
n = gets.to_i | |
if n == 42 | |
break | |
end | |
puts n | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TEST AC - Java | |
import java.io.*; | |
import java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
while(true) { | |
int n = in.nextInt(); | |
if (n == 42) break; | |
System.out.println(n); | |
} | |
} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TEST AC - C# (gmcs + Mono) | |
using System; | |
class WelcomeCSS { | |
static void Main() { | |
while(true) { | |
int n; | |
n = int.Parse(Console.ReadLine()); | |
if (n == 42) break; | |
Console.WriteLine(n); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment