Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
|
|
@ -1,20 +0,0 @@
|
|||
PROC doors = (INT limit)VOID:
|
||||
(
|
||||
MODE DOORSTATE = BOOL;
|
||||
BOOL closed = FALSE;
|
||||
BOOL open = NOT closed;
|
||||
MODE DOORLIST = [limit]DOORSTATE;
|
||||
|
||||
DOORLIST the doors;
|
||||
FOR i FROM LWB the doors TO UPB the doors DO the doors[i]:=closed OD;
|
||||
|
||||
FOR i FROM LWB the doors TO UPB the doors DO
|
||||
FOR j FROM LWB the doors BY i TO UPB the doors DO
|
||||
the doors[j] := NOT the doors[j]
|
||||
OD
|
||||
OD;
|
||||
FOR i FROM LWB the doors TO UPB the doors DO
|
||||
print((whole(i,-12)," is ",(the doors[i]|"opened"|"closed"),newline))
|
||||
OD
|
||||
);
|
||||
doors(100)
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
PROC doors optimised = ( INT limit )VOID:
|
||||
FOR i TO limit DO
|
||||
REAL num := sqrt(i);
|
||||
printf(($g" is "gl$,i,(ENTIER num = num |"opened"|"closed") ))
|
||||
OD
|
||||
;
|
||||
doors optimised(limit)
|
||||
23
Task/100-doors/Haxe/100-doors-1.haxe
Normal file
23
Task/100-doors/Haxe/100-doors-1.haxe
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
class Main
|
||||
{
|
||||
static public function main()
|
||||
{
|
||||
findOpenDoors( 100 );
|
||||
}
|
||||
|
||||
static function findOpenDoors( n : Int )
|
||||
{
|
||||
var door = [];
|
||||
for( i in 0...n + 1 ){ door[ i ] = false; }
|
||||
for( i in 1...n + 1 ){
|
||||
var j = i;
|
||||
while( j <= n ){
|
||||
door[ j ] = ! door[ j ];
|
||||
j += i;
|
||||
}
|
||||
}
|
||||
for( i in 1...n + 1 ){
|
||||
if( door[ i ] ){ Sys.print( ' $i' ); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ class RosettaDemo
|
|||
|
||||
while((i*i) <= n)
|
||||
{
|
||||
Sys.print(i*i + "\n");
|
||||
Sys.println(i*i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
var .doors = [false] x 100
|
||||
var .doors = [false] * 100
|
||||
|
||||
for .i of .doors {
|
||||
for .j = .i; .j <= len(.doors); .j += .i {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
writeln foldfrom(f if(.b: .a~[.c]; .a), [], .doors, series 1..len .doors)
|
||||
writeln foldfrom(fn(.a, .b, .c) if(.b: .a~[.c]; .a), [], .doors, series 1..len .doors)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
writeln map(f .x ^ 2, series 1..10)
|
||||
writeln map fn{^2}, 1..10
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
writeln map f{^2}, 1..10
|
||||
|
|
@ -1 +1 @@
|
|||
for i in range(1,101): print("Door %s is open" % i**2)
|
||||
for i in range(1,11): print("Door %s is open" % i**2)
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
10 rem loop
|
||||
|
||||
20 let i = i + 1
|
||||
30 print i * i, " open"
|
||||
|
||||
40 if i * i < 100 then 10
|
||||
|
||||
50 shell "pause"
|
||||
60 end
|
||||
Loading…
Add table
Add a link
Reference in a new issue