From fd4849655113ac9706753441de784780cc72c389 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 22 Nov 2021 13:45:55 +0100 Subject: Perl solutions for week 140 --- challenge-140/abigail/perl/ch-1.pl | 49 +++++++++++++++++ challenge-140/abigail/perl/ch-2.pl | 106 +++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 challenge-140/abigail/perl/ch-1.pl create mode 100644 challenge-140/abigail/perl/ch-2.pl diff --git a/challenge-140/abigail/perl/ch-1.pl b/challenge-140/abigail/perl/ch-1.pl new file mode 100644 index 0000000000..94726166cd --- /dev/null +++ b/challenge-140/abigail/perl/ch-1.pl @@ -0,0 +1,49 @@ +#!/opt/perl/bin/perl + +use 5.032; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-140/#TASK1 +# + +# +# Run as: perl ch-1.pl < input-file +# + +# +# This challenge is riddle with confusing directives. WTF is a +# "decimal-coded binary number"? Searching for that term on +# Google just returns results for Binary-coded decimals, which +# are well known. +# +# Second point: "simulate the addition of the given binary numbers". +# Uhm, virtually every general purpose computer made in the past +# 70 years does arithmetic using binary. Are we asked to simulate +# something which is already done? How? The examples just give answers, +# the answers are as closely related to spinach as they are to simulations. +# +# Third, it mentions operator overloading. Why? What? Without overloading +# binary "+" adds two numbers. We're asked to add two numbers. Why on earth +# would you want to overload an operator? +# + +# +# As the description of the challenge is pretty pointless, we have to +# resort to extract the purpose: +# - Give two binary numbers, add them, and print the result in binary +# +# Which means, this challenge is about translating to and from binary +# string representation. We use 'oct' for the latter, and sprintf for the +# former. +# +# This leaves us a one-liner: +# + +say sprintf "%b" => eval join " + " => map {oct "0b$_"} split while <>; diff --git a/challenge-140/abigail/perl/ch-2.pl b/challenge-140/abigail/perl/ch-2.pl new file mode 100644 index 0000000000..b391a00101 --- /dev/null +++ b/challenge-140/abigail/perl/ch-2.pl @@ -0,0 +1,106 @@ +#!/opt/perl/bin/perl + +use 5.032; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-140/#TASK2 +# + +# +# Run as: perl ch-2.pl < input-file +# + +# +# A trivial way to solve this is to calculate all numbers +# m = p * q, 1 <= p <= i, 1 <= q <= j, sort them, and select +# the kth number from the sorted list. +# +# This takes O (i * j * log (i * j)) time, using O (i * j) memory. +# Which, for the trivial examples of the challenge is peanuts. +# But if i and j are large, say 1,000,000, this becomes a problem. +# +# An alternative way would be scan the table in order, only generating +# as many numbers are needed: +# +# * Assume i <= j (else, just swap i and j) +# +# * Create i pairs. Initialize each pair P_n as [n, 1], 1 <= n <= i. +# Each pair corresponds to the column in the multiplication table. +# Since the values in a column are sorted, we only need to keep +# track of the highest element we haven't descarded yet. +# * Store each pair in a heap, ordered on P_n [0] * P_n [1], such +# that the pair with the smallest product is on top. +# * Let c = 0; while c < k: +# + Let Q be the pair on top of the heap. +# + Q [1] = Q [1] >= j ? Q [i * j + 1] : Q [1] + 1 [*] +# + Restore the heap +# * If c == k, then the wanted number is product of the pair at +# the top of the heap. +# +# [*] If Q [1] >= j, we have reached the bottom of the column, so the +# answer we're seeking cannot be in this column. By setting Q [1] +# to i * j + 1, it will be larger than the answer we're looking for, +# and we'll never consult this column again. +# +# Building the heap is O (i) (trivial in this case, as we can generate +# the elements in a sorted way). Restoring the heap takes O (log (i)). +# Hence, the total running time is O (i + k * log (i)), using O (i) +# memory. +# + + +sub prod ($pair) {$$pair [0] * $$pair [1]} +sub left ($index) {2 * $index + 1} +sub right ($index) {2 * $index + 2} + +sub make_heap ($i) {[map {[$_, 1]} 1 .. $i]} +sub rebalance ($heap, $index = 0) { + my $index1 = left $index; # Left child + my $index2 = right $index; # Right child + return if $index1 > $#$heap; # No children, so we're done. + my $p = prod $$heap [$index]; + # + # Find the smallest of the children + # + my $p1 = prod $$heap [$index1]; + if ($index2 <= $#$heap) { + my $p2 = prod $$heap [$index2]; + # + # Right child is smaller than left child, so right child wins + # + if ($p2 < $p1) { + $p1 = $p2; + $index1 = $index2; + } + } + # + # Now, $p1 is the smallest child, and on index $index1. + # If the smallest child is smaller than the current element, + # swap, and recurse. Else, we're done. + # + if ($p1 < $p) { + @$heap [$index, $index1] = @$heap [$index1, $index]; + rebalance ($heap, $index1); + } +} + + +while (<>) { + my ($i, $j, $k) = split; + ($j, $i) = ($i, $j) if $j < $i; + my $heap = make_heap ($i); + while ($k -- > 1) { + $$heap [0] [1] = $$heap [0] [1] >= $j ? $i * $j + 1 + : $$heap [0] [1] + 1; + rebalance ($heap); + } + say prod $$heap [0]; +} + -- cgit From fb39699b31d65405e7d104ee2b1c1c4edcdf51a8 Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 23 Nov 2021 16:00:43 +0100 Subject: Solutions for week 140, part 1. --- challenge-140/abigail/README.md | 1 - challenge-140/abigail/awk/ch-1.awk | 38 +++++++++++++++++++++ challenge-140/abigail/awk/ch-2.awk | 29 ++++++++++++++++ challenge-140/abigail/bash/ch-1.sh | 42 +++++++++++++++++++++++ challenge-140/abigail/bash/ch-2.sh | 32 ++++++++++++++++++ challenge-140/abigail/bc/ch-1.bc | 18 ++++++++++ challenge-140/abigail/bc/ch-2.bc | 29 ++++++++++++++++ challenge-140/abigail/c/ch-1.c | 62 ++++++++++++++++++++++++++++++++++ challenge-140/abigail/c/ch-2.c | 39 +++++++++++++++++++++ challenge-140/abigail/go/ch-1.go | 32 ++++++++++++++++++ challenge-140/abigail/go/ch-2.go | 37 ++++++++++++++++++++ challenge-140/abigail/java/ch-1.java | 22 ++++++++++++ challenge-140/abigail/java/ch-2.java | 33 ++++++++++++++++++ challenge-140/abigail/lua/ch-1.lua | 28 +++++++++++++++ challenge-140/abigail/lua/ch-2.lua | 30 ++++++++++++++++ challenge-140/abigail/node/ch-1.js | 17 ++++++++++ challenge-140/abigail/node/ch-2.js | 28 +++++++++++++++ challenge-140/abigail/pascal/ch-1.p | 40 ++++++++++++++++++++++ challenge-140/abigail/pascal/ch-2.p | 36 ++++++++++++++++++++ challenge-140/abigail/python/ch-1.py | 15 ++++++++ challenge-140/abigail/python/ch-2.py | 25 ++++++++++++++ challenge-140/abigail/r/ch-1.r | 22 ++++++++++++ challenge-140/abigail/r/ch-2.r | 33 ++++++++++++++++++ challenge-140/abigail/ruby/ch-1.rb | 15 ++++++++ challenge-140/abigail/ruby/ch-2.rb | 27 +++++++++++++++ challenge-140/abigail/scheme/ch-1.scm | 41 ++++++++++++++++++++++ challenge-140/abigail/scheme/ch-2.scm | 62 ++++++++++++++++++++++++++++++++++ challenge-140/abigail/t/ctest.ini | 11 ++++++ challenge-140/abigail/t/input-1-1 | 3 ++ challenge-140/abigail/t/input-2-1 | 2 ++ challenge-140/abigail/t/output-1-1.exp | 3 ++ challenge-140/abigail/t/output-2-1.exp | 2 ++ challenge-140/abigail/tcl/ch-1.tcl | 29 ++++++++++++++++ challenge-140/abigail/tcl/ch-2.tcl | 24 +++++++++++++ 34 files changed, 906 insertions(+), 1 deletion(-) create mode 100644 challenge-140/abigail/awk/ch-1.awk create mode 100644 challenge-140/abigail/awk/ch-2.awk create mode 100644 challenge-140/abigail/bash/ch-1.sh create mode 100644 challenge-140/abigail/bash/ch-2.sh create mode 100644 challenge-140/abigail/bc/ch-1.bc create mode 100644 challenge-140/abigail/bc/ch-2.bc create mode 100644 challenge-140/abigail/c/ch-1.c create mode 100644 challenge-140/abigail/c/ch-2.c create mode 100644 challenge-140/abigail/go/ch-1.go create mode 100644 challenge-140/abigail/go/ch-2.go create mode 100644 challenge-140/abigail/java/ch-1.java create mode 100644 challenge-140/abigail/java/ch-2.java create mode 100644 challenge-140/abigail/lua/ch-1.lua create mode 100644 challenge-140/abigail/lua/ch-2.lua create mode 100644 challenge-140/abigail/node/ch-1.js create mode 100644 challenge-140/abigail/node/ch-2.js create mode 100644 challenge-140/abigail/pascal/ch-1.p create mode 100644 challenge-140/abigail/pascal/ch-2.p create mode 100644 challenge-140/abigail/python/ch-1.py create mode 100644 challenge-140/abigail/python/ch-2.py create mode 100644 challenge-140/abigail/r/ch-1.r create mode 100644 challenge-140/abigail/r/ch-2.r create mode 100644 challenge-140/abigail/ruby/ch-1.rb create mode 100644 challenge-140/abigail/ruby/ch-2.rb create mode 100644 challenge-140/abigail/scheme/ch-1.scm create mode 100644 challenge-140/abigail/scheme/ch-2.scm create mode 100644 challenge-140/abigail/t/ctest.ini create mode 100644 challenge-140/abigail/t/input-1-1 create mode 100644 challenge-140/abigail/t/input-2-1 create mode 100644 challenge-140/abigail/t/output-1-1.exp create mode 100644 challenge-140/abigail/t/output-2-1.exp create mode 100644 challenge-140/abigail/tcl/ch-1.tcl create mode 100644 challenge-140/abigail/tcl/ch-2.tcl diff --git a/challenge-140/abigail/README.md b/challenge-140/abigail/README.md index bb2b1dda43..0707d1fbd5 100644 --- a/challenge-140/abigail/README.md +++ b/challenge-140/abigail/README.md @@ -6,7 +6,6 @@ * [Bash](bash/ch-1.sh) * [Bc](bc/ch-1.bc) * [C](c/ch-1.c) -* [Erlang](c/ch-1.erl) * [Go](go/ch-1.go) * [Java](java/ch-1.java) * [Lua](lua/ch-1.lua) diff --git a/challenge-140/abigail/awk/ch-1.awk b/challenge-140/abigail/awk/ch-1.awk new file mode 100644 index 0000000000..3210e7b108 --- /dev/null +++ b/challenge-140/abigail/awk/ch-1.awk @@ -0,0 +1,38 @@ +#!/usr/bin/awk + +# +# See ../README.md +# + +# +# Run as: awk -f ch-1.awk < input-file +# + +# +# Take a binary representation, return its decimal equivalent +# +function bin2dec (bin, dec, digits, n) { + dec = 0 + n = split (bin, digits, "") + for (i = 1; i <= n; i ++) { + dec = 2 * dec + digits [i] + } + return (dec) +} + + +# +# Get a binary representation +# +function dec2bin (dec, bin) { + while (dec) { + bin = dec % 2 bin + dec = int (dec / 2) + } + return (bin) +} + + +{ + print dec2bin(bin2dec($1) + bin2dec($2)) +} diff --git a/challenge-140/abigail/awk/ch-2.awk b/challenge-140/abigail/awk/ch-2.awk new file mode 100644 index 0000000000..32372950cc --- /dev/null +++ b/challenge-140/abigail/awk/ch-2.awk @@ -0,0 +1,29 @@ +#!/usr/bin/awk + +# +# See ../README.md +# + +# +# Run as: awk -f ch-2.awk < input-file +# + +{ + i = $1 + j = $2 + k = $3 + + n = 0 + while (k > 0) { + n ++ + s = int (sqrt (n)) + for (d = 1; d <= s && k > 0; d ++) { + if (!(n % d)) { + k -= (d <= i && n / d <= j) + \ + (d <= j && n / d <= i) - (n == d * d) + } + } + } + print (n) +} + diff --git a/challenge-140/abigail/bash/ch-1.sh b/challenge-140/abigail/bash/ch-1.sh new file mode 100644 index 0000000000..24b57c5079 --- /dev/null +++ b/challenge-140/abigail/bash/ch-1.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# +# See ../README.md +# + +# +# Run as: bash ch-1.sh < input-file +# + +# +# Take a binary representation, return its decimal equivalent +# +function bin2dec () { + local bin=$1 + local i + ((dec = 0)) + for ((i = 0; i < ${#bin}; i ++)) { + ((dec = 2 * dec + ${bin:$i:1})) + } +} + +# +# Given a decimal number, return its binary representation +# +function dec2bin () { + local dec=$1 + bin="" + while ((dec > 0)) + do bin=$((dec % 2))$bin + ((dec /= 2)) + done +} + +set -f + +while read a b +do bin2dec $a; a=$dec + bin2dec $b; b=$dec + dec2bin $((a + b)) + echo $bin +done diff --git a/challenge-140/abigail/bash/ch-2.sh b/challenge-140/abigail/bash/ch-2.sh new file mode 100644 index 0000000000..16757fccb3 --- /dev/null +++ b/challenge-140/abigail/bash/ch-2.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# +# See ../README.md +# + +# +# Run as: bash ch-2.sh < input-file +# + +set -f + +while read i j k +do ((n = 0)) + while ((k > 0)) + do ((n ++)) + for ((d = 1; d * d <= n && k > 0; d ++)) + do if ((n % d == 0)) + then if ((d <= i && n / d <= j)) + then ((k --)) + fi + if ((d <= j && n / d <= i)) + then ((k --)) + fi + if ((n == d * d)) + then ((k ++)) + fi + fi + done + done + echo $n +done diff --git a/challenge-140/abigail/bc/ch-1.bc b/challenge-140/abigail/bc/ch-1.bc new file mode 100644 index 0000000000..9e1fe422ad --- /dev/null +++ b/challenge-140/abigail/bc/ch-1.bc @@ -0,0 +1,18 @@ +# +# See ../README.md +# + +# +# Run as: bc ch-1.bc < input-file +# + +obase=2 +ibase=2 + +while (1) { + a = read(); if (a == 0) {break} + b = read(); if (b == 0) {break} + a + b +} + +quit diff --git a/challenge-140/abigail/bc/ch-2.bc b/challenge-140/abigail/bc/ch-2.bc new file mode 100644 index 0000000000..bb4f56c509 --- /dev/null +++ b/challenge-140/abigail/bc/ch-2.bc @@ -0,0 +1,29 @@ +# +# See ../README.md +# + +# +# Run as: bc ch-2.bc < input-file +# + +while (1) { + i = read (); if (i == 0) {break} + j = read (); if (j == 0) {break} + k = read (); if (k == 0) {break} + + n = 0 + while (k > 0) { + n = n + 1 + for (d = 1; d * d <= n && k > 0; d ++) { + if (n % d == 0) { + if (d <= i && n / d <= j) {k = k - 1} + if (d <= j && n / d <= i) {k = k - 1} + if (n == d * d) {k = k + 1} + } + } + } + + n +} + +quit diff --git a/challenge-140/abigail/c/ch-1.c b/challenge-140/abigail/c/ch-1.c new file mode 100644 index 0000000000..6c9024bda9 --- /dev/null +++ b/challenge-140/abigail/c/ch-1.c @@ -0,0 +1,62 @@ +# include +# include +# include + +/* + * See ../README.md + */ + +/* + * Run as: cc -o ch-1.o ch-1.c; ./ch-1.o < input-file + */ + +/* + * Given a decimal number, return its binary representation + */ +char * dec2bin (long dec) { + char * bin; + if ((bin = (char *) malloc (32 * sizeof (char))) == NULL) { + perror ("Malloc failed"); + exit (1); + } + if (dec == 0) { /* Special case dec == 0 */ + bin [0] = '0'; + bin [1] = '\0'; + return (bin); + } + size_t i = 0; + while (dec) { + bin [i ++] = '0' + dec % 2; + dec /= 2; + } + /* + * Reverse the string + */ + for (size_t j = 0; j < i / 2; j ++) { + char t = bin [j]; + bin [j] = bin [i - j - 1]; + bin [i - j - 1] = t; + } + + bin [i] = '\0'; + return (bin); +} + + +int main (void) { + char * line = NULL; + size_t len = 0; + size_t str_len; + + while ((str_len = getline (&line, &len, stdin)) != -1) { + char * end_ptr; + long a = strtol (line, &end_ptr, 2); + long b = strtol (end_ptr, NULL, 2); + char * bin = dec2bin (a + b); + printf ("%s\n", bin); + free (bin); + } + free (line); + + return (0); +} diff --git a/challenge-140/abigail/c/ch-2.c b/challenge-140/abigail/c/ch-2.c new file mode 100644 index 0000000000..b57fb1d955 --- /dev/null +++ b/challenge-140/abigail/c/ch-2.c @@ -0,0 +1,39 @@ +# include +# include +# include +# include + +/* + * See ../README.md + */ + +/* + * Run as: cc -o ch-2.o ch-2.c; ./ch-2.o < input-file + */ + +int main (void) { + long i, j; + long long k; + + while (scanf ("%ld%ld%lld", &i, &j, &k) == 3) { + long long n = 0; + while (k > 0) { + long s = lrintf (sqrt (++ n)); + for (long d = 1; d <= s && k > 0; d ++) { + /* + * Subtract the number of divisors d, where d <= i, + * and n / d <= j, or d <= j and n / d <= i. + * A number d is a divisor if n % d == 0. + * We should count a divisor only once if n == d * d. + */ + if (!(n % d)) { + k -= (d <= i && n / d <= j) + + (d <= j && n / d <= i) - (n == d * d); + } + } + } + printf ("%lld\n", n); + } + + return (0); +} diff --git a/challenge-140/abigail/go/ch-1.go b/challenge-140/abigail/go/ch-1.go new file mode 100644 index 0000000000..c355358d16 --- /dev/null +++ b/challenge-140/abigail/go/ch-1.go @@ -0,0 +1,32 @@ +package main + +// +// See ../README.md +// + +// +// Run as: go run ch-1.go +// + +import ( + "fmt" + "bufio" + "os" + "strconv" + "strings" +) + +func main () { + var reader = bufio . NewReader (os. Stdin) + for { + var text, err = reader . ReadString ('\n') + if (err != nil) { + break + } + bins := strings . Split (strings . Trim (text, "\n"), " ") + a, _ := strconv . ParseInt (bins [0], 2, 0) + b, _ := strconv . ParseInt (bins [1], 2, 0) + + fmt . Println (strconv . FormatInt (a + b, 2)) + } +} diff --git a/challenge-140/abigail/go/ch-2.go b/challenge-140/abigail/go/ch-2.go new file mode 100644 index 0000000000..0f35815237 --- /dev/null +++ b/challenge-140/abigail/go/ch-2.go @@ -0,0 +1,37 @@ +package main + +// +// See ../README.md +// + +// +// Run as: go run ch-2.go < input-file +// + +import ( + "fmt" + "math" +) + +func main () { + for { + var i, j, k int64 + c, err := fmt . Scanf ("%d %d %d", &i, &j, &k) + if (c != 3 || err != nil) { + break; + } + n := int64 (0) + for ;k > 0; { + n ++ + s := int64 (math . Sqrt (float64 (n))) + for d := int64 (1); d <= s && k > 0; d ++ { + if (n % d == 0) { + if (d <= i && n / d <= j) {k --} + if (d <= j && n / d <= i) {k --} + if (n == d * d) {k ++} + } + } + } + fmt . Println (n) + } +} diff --git a/challenge-140/abigail/java/ch-1.java b/challenge-140/abigail/java/ch-1.java new file mode 100644 index 0000000000..7d93af1d7d --- /dev/null +++ b/challenge-140/abigail/java/ch-1.java @@ -0,0 +1,22 @@ +// +// See ../README.md +// + +// +// Run as: ln ch-1.java ch1.java; javac ch1.java; java ch1 < input-file +// + +import java.util.*; + +public class ch1 { + public static void main (String [] args) { + Scanner scanner = new Scanner (System . in); + while (scanner . hasNextLine ()) { + String line = scanner . nextLine (); + String [] parts = line . trim () . split (" "); + int a = Integer . parseInt (parts [0], 2); + int b = Integer . parseInt (parts [1], 2); + System . out . println (Integer . toBinaryString (a + b)); + } + } +} diff --git a/challenge-140/abigail/java/ch-2.java b/challenge-140/abigail/java/ch-2.java new file mode 100644 index 0000000000..90c4bd998f --- /dev/null +++ b/challenge-140/abigail/java/ch-2.java @@ -0,0 +1,33 @@ +// +// See ../README.md +// + +// +// Run as: ln ch-2.java ch2.java; javac ch2.java; java ch2 < input-file +// + +import java.util.*; + +public class ch2 { + public static void main (String [] args) { + Scanner scanner = new Scanner (System . in); + while (scanner . hasNextLong ()) { + long i = scanner . nextLong (); + long j = scanner . nextLong (); + long k = scanner . nextLong (); + long n = 0; + while (k > 0) { + n ++; + long s = (long) Math . sqrt (n); + for (long d = 1; d <= s && k > 0; d ++) { + if (n % d == 0) { + if (d <= i && n / d <= j) {k --;} + if (d <= j && n / d <= i) {k --;} + if (n == d * d) {k ++;} + } + } + } + System . out . println (n); + } + } +} diff --git a/challenge-140/abigail/lua/ch-1.lua b/challenge-140/abigail/lua/ch-1.lua new file mode 100644 index 0000000000..b0ad7ae3fd --- /dev/null +++ b/challenge-140/abigail/lua/ch-1.lua @@ -0,0 +1,28 @@ +#!/opt/local/bin/lua + +-- +-- See ../README.md +-- + +-- +-- Run as: lua ch-1.lua < input-file +-- + +function dec2bin (dec) + local bin = {} + local out = "" + while dec > 0 do + bin [#bin + 1] = dec % 2 + dec = math . floor (dec / 2) + end + for i = #bin, 1, -1 do + out = out .. bin [i] + end + return out +end + + +for line in io . lines () do + _, _, a, b = line : find ("([01]+)%s+([01]+)") + print (dec2bin (tonumber (a, 2) + tonumber (b, 2))) +end diff --git a/challenge-140/abigail/lua/ch-2.lua b/challenge-140/abigail/lua/ch-2.lua new file mode 100644 index 0000000000..601fc35041 --- /dev/null +++ b/challenge-140/abigail/lua/ch-2.lua @@ -0,0 +1,30 @@ +#!/opt/local/bin/lua + +-- +-- See ../README.md +-- + +-- +-- Run as: lua ch-2.lua < input-file +-- + +for line in io . lines () do + local _, _, i, j, k = line : find ("([0-9]+)%s+([0-9]+)%s+([0-9]+)") + i = tonumber (i) + j = tonumber (j) + k = tonumber (k) + + local n = 0 + while k > 0 do + n = n + 1 + local s = math . floor (math . sqrt (n)) + for d = 1, s do + if n % d == 0 then + if d <= i and n / d <= j then k = k - 1 end + if d <= j and n / d <= i then k = k - 1 end + if n == d * d then k = k + 1 end + end + end + end + print (n) +end diff --git a/challenge-140/abigail/node/ch-1.js b/challenge-140/abigail/node/ch-1.js new file mode 100644 index 0000000000..18dc51e939 --- /dev/null +++ b/challenge-140/abigail/node/ch-1.js @@ -0,0 +1,17 @@ +#!/usr/local/bin/node + +// +// See ../README.md +// + +// +// Run as: node ch-1.js < input-file +// + + require ('readline') +. createInterface ({input: process . stdin}) +. on ('line', line => { + let [a, b] = line . trim () . split (" "); + console . log ((parseInt (a, 2) + parseInt (b, 2)) . toString (2)) +}) + diff --git a/challenge-140/abigail/node/ch-2.js b/challenge-140/abigail/node/ch-2.js new file mode 100644 index 0000000000..711c05f7de --- /dev/null +++ b/challenge-140/abigail/node/ch-2.js @@ -0,0 +1,28 @@ +#!/usr/local/bin/node + +// +// See ../README.md +// + +// +// Run as: node ch-2.js < input-file +// + + require ('readline') +. createInterface ({input: process . stdin}) +. on ('line', line => { + let [i, j, k] = line . split (" ") . map (_ => +_) + let n = 0 + while (k > 0) { + n ++ + let s = Math . floor (Math . sqrt (n)) + for (let d = 1; d <= s && k > 0; d ++) { + if (n % d == 0) { + if (d <= i && n / d <= j) {k --} + if (d <= j && n / d <= i) {k --} + if (n == d * d) {k ++} + } + } + } + console . log (n) +}) diff --git a/challenge-140/abigail/pascal/ch-1.p b/challenge-140/abigail/pascal/ch-1.p new file mode 100644 index 0000000000..57e691e9c0 --- /dev/null +++ b/challenge-140/abigail/pascal/ch-1.p @@ -0,0 +1,40 @@ +Program ch1; + +uses Strutils; + +(* *) +(* See ../README.md *) +(* *) + +(* *) +(* Run as: fpc -och-1.out ch-1.p; ./ch-1.out < input-file *) +(* *) + +function bin2dec (bin: string): longint; + var + c: char; + dec: integer = 0; + + begin + for c in bin do begin + dec := dec * 2; + if c = '1' then begin + dec := dec + 1; + end; + end; + bin2dec := dec; + end; + +var + n1, n2: longint; + a, b: string; + +begin + while not eof do begin + readln (n1, n2); + a := Dec2Numb (n1, 1, 10); + b := Dec2Numb (n2, 1, 10); + + writeln (Dec2Numb (bin2dec (a) + bin2dec (b), 1, 2)); + end +end. diff --git a/challenge-140/abigail/pascal/ch-2.p b/challenge-140/abigail/pascal/ch-2.p new file mode 100644 index 0000000000..9eb1661bfc --- /dev/null +++ b/challenge-140/abigail/pascal/ch-2.p @@ -0,0 +1,36 @@ +Program ch2; + +(* *) +(* See ../README.md *) +(* *) + +(* *) +(* Run as: fpc -och-2.out ch-2.p; ./ch-2.out < input-file *) +(* *) + +uses + math; + +var + i, j, k, n, s, d: longint; + +begin + while not eof do begin + readln (i, j, k); + + n := 0; + + while k > 0 do begin + inc (n); + s := round (sqrt (n)); + for d := 1 to s do begin + if n mod d = 0 then begin + if (d <= i) and (n / d <= j) then begin dec (k); end; + if (d <= j) and (n / d <= i) then begin dec (k); end; + if (n = d * d) then begin inc (k); end; + end + end + end; + writeln (n); + end +end. diff --git a/challenge-140/abigail/python/ch-1.py b/challenge-140/abigail/python/ch-1.py new file mode 100644 index 0000000000..7002b13c03 --- /dev/null +++ b/challenge-140/abigail/python/ch-1.py @@ -0,0 +1,15 @@ +#!/opt/local/bin/python + +# +# See ../README.md +# + +# +# Run as: python ch-1.py < input-file +# + +import fileinput + +for line in fileinput . input (): + a, b = line . strip () . split (" ") + print (bin (int (a, 2) + int (b, 2)) [2:]) diff --git a/challenge-140/abigail/python/ch-2.py b/challenge-140/abigail/python/ch-2.py new file mode 100644 index 0000000000..a7bdccbb49 --- /dev/null +++ b/challenge-140/abigail/python/ch-2.py @@ -0,0 +1,25 @@ +#!/opt/local/bin/python + +# +# See ../README.md +# + +# +# Run as: python ch-2.py < input-file +# + +import fileinput +import math + +for line in fileinput . input (): + i, j, k = map (lambda x: int (x), line . strip () . split (" ")) + n = 0 + while k > 0: + n = n + 1 + s = math . floor (math . sqrt (n)) + for d in range (1, s + 1): + if n % d == 0: + if d <= i and n / d <= j: k = k - 1 + if d <= j and n / d <= i: k = k - 1 + if n == d * d: k = k + 1 + print (n) diff --git a/challenge-140/abigail/r/ch-1.r b/challenge-140/abigail/r/ch-1.r new file mode 100644 index 0000000000..10fd49abb3 --- /dev/null +++ b/challenge-140/abigail/r/ch-1.r @@ -0,0 +1,22 @@ +# +# See ../README.md +# + +# +# Run as: Rscript ch-1.r < input-file +# + +stdin <- file ('stdin', 'r') +repeat { + line <- readLines (stdin, n = 1) + if (length (line) == 0) { + break + } + + parts <- strsplit (line, " ") + a <- strtoi (parts [[1]] [[1]], 2) + b <- strtoi (parts [[1]] [[2]], 2) + + cat (as.integer (paste (as.integer (rev (intToBits (a + b))), + collapse = "")), "\n") +} diff --git a/challenge-140/abigail/r/ch-2.r b/challenge-140/abigail/r/ch-2.r new file mode 100644 index 0000000000..a83d05ccce --- /dev/null +++ b/challenge-140/abigail/r/ch-2.r @@ -0,0 +1,33 @@ +# +# See ../README.md +# + +# +# Run as: Rscript ch-2.r < input-file +# + +stdin <- file ('stdin', 'r') +repeat { + line <- readLines (stdin, n = 1) + if (length (line) == 0) { + break + } + parts <- strsplit (line, " ") + list <- as.numeric (parts [[1]]) + i <- list [[1]] + j <- list [[2]] + k <- list [[3]] + n <- 0 + while (k > 0) { + n <- n + 1 + s <- floor (sqrt (n)) + for (d in 1 : s) { + if (n %% d == 0) { + if (d <= i && n / d <= j) {k = k - 1} + if (d <= j && n / d <= i) {k = k - 1} + if (n == d * d) {k = k + 1} + } + } + } + cat (sprintf ("%d\n", n)) +} diff --git a/challenge-140/abigail/ruby/ch-1.rb b/challenge-140/abigail/ruby/ch-1.rb new file mode 100644 index 0000000000..bc95be2323 --- /dev/null +++ b/challenge-140/abigail/ruby/ch-1.rb @@ -0,0 +1,15 @@ +#!/usr/bin/ruby + +# +# See ../README.md +# + +# +# Run as: ruby ch-1.rb < input-file +# + +ARGF . each_line do + | line | + a, b = line . strip() . split (" ") + puts (a . to_i(2) + b . to_i(2)) . to_s(2) +end diff --git a/challenge-140/abigail/ruby/ch-2.rb b/challenge-140/abigail/ruby/ch-2.rb new file mode 100644 index 0000000000..fe2f27a992 --- /dev/null +++ b/challenge-140/abigail/ruby/ch-2.rb @@ -0,0 +1,27 @@ +#!/usr/bin/ruby + +# +# See ../README.md +# + +# +# Run as: ruby ch-2.rb < input-file +# + +ARGF . each_line do + | line | + i, j, k = line . strip() . split . map {|x| x . to_i} + n = 0 + while k > 0 do + n = n + 1 + s = Math . sqrt(n) . floor() + for d in 1 .. s do + if n % d == 0 then + if d <= i && n / d <= j then k = k - 1 end + if d <= j && n / d <= i then k = k - 1 end + if n == d * d then k = k + 1 end + end + end + end + puts (n) +end diff --git a/challenge-140/abigail/scheme/ch-1.scm b/challenge-140/abigail/scheme/ch-1.scm new file mode 100644 index 0000000000..45c7e0fc71 --- /dev/null +++ b/challenge-140/abigail/scheme/ch-1.scm @@ -0,0 +1,41 @@ +;;; +;;; See ../README.md +;;; + +;;; +;;; Run as: guile --no-auto-compile ch-1.scm +;;; + +(use-modules (ice-9 rdelim)) +(use-modules (srfi srfi-1)) + +(define (bin2dec bin) + (define len (string-length bin)) + (cond ((= len 0) 0) + (else (+ (string->number (string-take-right bin 1)) + (* 2 (bin2dec (string-drop-right bin 1))))))) + +(define (_dec2bin dec) + (cond ((= dec 0) "") + (else (string-concatenate + (list (_dec2bin (floor-quotient dec 2)) + (number->string (modulo dec 2))))))) + +(define (dec2bin dec) + (cond ((= dec 0) "0") + (else (_dec2bin dec)))) + +(define (main) + (define line (read-line)) + (define parts) + (if (not (eof-object? line)) + (begin + (display (dec2bin (fold + 0 (map bin2dec (string-split line #\ ))))) + (newline) + (main) + ) + ) +) + + +(main) diff --git a/challenge-140/abigail/scheme/ch-2.scm b/challenge-140/abigail/scheme/ch-2.scm new file mode 100644 index 0000000000..c38d93c582 --- /dev/null +++ b/challenge-140/abigail/scheme/ch-2.scm @@ -0,0 +1,62 @@ +;;; +;;; See ../README.md +;;; + +;;; +;;; Run as: guile --no-auto-compile ch-2.scm < input-file +;;; + +(use-modules (ice-9 rdelim)) +(use-modules (srfi srfi-1)) + +;; +;; Return the number of divisors of n, where the divisors don't +;; exceed neither i nor j +;; +(define (divisors n i j) + (define s (inexact->exact (round (sqrt n)))) + (define c 0) + (do ((d 1 (1+ d))) + ((> d s)) + (if (= (modulo n d) 0) + (begin + (if (and (<= d i) (<= (/ n d) j)) (set! c (+ c 1))) + (if (and (<= d j) (<= (/ n d) i)) (set! c (+ c 1))) + (if (= n (* d d)) (set! c (- c 1))) + ) + ) + ) + c +) + + + +(define (find-kth list) + (define i (list-ref list 0)) + (define j (list-ref list 1)) + (define k (list-ref list 2)) + (define n 0) + (while (> k 0) + (begin + (set! n (+ 1 n)) + (set! k (- k (divisors n i j))) + ) + ) + n +) + +(define (main) + (define line (read-line)) + (define parts) + (if (not (eof-object? line)) + (begin + (display (find-kth (map string->number (string-split line #\ )))) + (newline) + (main) + ) + ) +) + +;; (display (divisors 12 10 10))(newline) + +(main) diff --git a/challenge-140/abigail/t/ctest.ini b/challenge-140/abigail/t/ctest.ini new file mode 100644 index 0000000000..a0b58af962 --- /dev/null +++ b/challenge-140/abigail/t/ctest.ini @@ -0,0 +1,11 @@ +# +# Configuration file for running tests, using ctest. +# See https://github.com/Abigail/Misc/blob/master/ctest +# + +[names] +1-1 = Given Examples +2-1 = Given Examples + +[1-1/bc] +add_to_input = 0 diff --git a/challenge-140/abigail/t/input-1-1 b/challenge-140/abigail/t/input-1-1 new file mode 100644 index 0000000000..d481afb409 --- /dev/null +++ b/challenge-140/abigail/t/input-1-1 @@ -0,0 +1,3 @@ +11 1 +101 1 +100 11 diff --git a/challenge-140/abigail/t/input-2-1 b/challenge-140/abigail/t/input-2-1 new file mode 100644 index 0000000000..c6793cdf64 --- /dev/null +++ b/challenge-140/abigail/t/input-2-1 @@ -0,0 +1,2 @@ +2 3 4 +3 3 6 diff --git a/challenge-140/abigail/t/output-1-1.exp b/challenge-140/abigail/t/output-1-1.exp new file mode 100644 index 0000000000..81e2d53716 --- /dev/null +++ b/challenge-140/abigail/t/output-1-1.exp @@ -0,0 +1,3 @@ +100 +110 +111 diff --git a/challenge-140/abigail/t/output-2-1.exp b/challenge-140/abigail/t/output-2-1.exp new file mode 100644 index 0000000000..b94473479c --- /dev/null +++ b/challenge-140/abigail/t/output-2-1.exp @@ -0,0 +1,2 @@ +3 +4 diff --git a/challenge-140/abigail/tcl/ch-1.tcl b/challenge-140/abigail/tcl/ch-1.tcl new file mode 100644 index 0000000000..57a1b0fed3 --- /dev/null +++ b/challenge-140/abigail/tcl/ch-1.tcl @@ -0,0 +1,29 @@ +# +# See ../README.md +# + +# +# Run as: tclsh ch-1.tcl < input-file +# + +proc bin2dec bin { + set dec 0 + foreach c [split $bin {}] { + set dec [expr 2 * $dec + $c] + } + return $dec +} + +proc dec2bin dec { + set bin {} + while {$dec > 0} { + set bin [expr {$dec % 2}]$bin + set dec [expr {$dec / 2}] + } + return $bin +} + +while {[gets stdin line] >= 0} { + lassign [split $line " "] a b + puts [dec2bin [expr [bin2dec $a] + [bin2dec $b]]] +} diff --git a/challenge-140/abigail/tcl/ch-2.tcl b/challenge-140/abigail/tcl/ch-2.tcl new file mode 100644 index 0000000000..cc64678c3b --- /dev/null +++ b/challenge-140/abigail/tcl/ch-2.tcl @@ -0,0 +1,24 @@ +# +# See ../README.md +# + +# +# Run as: tclsh ch-2.tcl < input-file +# + +while {[gets stdin line] >= 0} { + lassign [split $line " "] i j k + set n 0 + while {$k > 0} { + incr n + set s [expr isqrt ($n)] + for {set d 1} {$d <= $s} {incr d} { + if {$n % $d == 0} { + if {$d <= $i && $n / $d <= $j} {incr k -1} + if {$d <= $j && $n / $d <= $i} {incr k -1} + if {$n == $d * $d} {incr k} + } + } + } + puts $n +} -- cgit From 9631b89a6de1800d81ef628439ed18f31d26d418 Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 23 Nov 2021 19:07:15 +0100 Subject: Multiple Perl solutions for week 140, part 2 --- challenge-140/abigail/perl/ch-2.pl | 95 +++++++---------------------------- challenge-140/abigail/perl/ch-2a.pl | 98 +++++++++++++++++++++++++++++++++++++ challenge-140/abigail/perl/ch-2b.pl | 32 ++++++++++++ 3 files changed, 147 insertions(+), 78 deletions(-) create mode 100644 challenge-140/abigail/perl/ch-2a.pl create mode 100644 challenge-140/abigail/perl/ch-2b.pl diff --git a/challenge-140/abigail/perl/ch-2.pl b/challenge-140/abigail/perl/ch-2.pl index b391a00101..91d052e4e5 100644 --- a/challenge-140/abigail/perl/ch-2.pl +++ b/challenge-140/abigail/perl/ch-2.pl @@ -18,89 +18,28 @@ use experimental 'lexical_subs'; # # -# A trivial way to solve this is to calculate all numbers -# m = p * q, 1 <= p <= i, 1 <= q <= j, sort them, and select -# the kth number from the sorted list. +# We consider all numbers, starting from 1. For each number $n, we will +# count how many times it occurs in the multiplication table. This +# is exactly the numbers of divisor $d, such that $d <= $i and $n / $d <= $j. +# Then it's just a matter of bookkeepping till we have found the right +# solution. # -# This takes O (i * j * log (i * j)) time, using O (i * j) memory. -# Which, for the trivial examples of the challenge is peanuts. -# But if i and j are large, say 1,000,000, this becomes a problem. +# Math::Prime::Util has a utility function, fordivisors, which iterates +# over the divisors of a given number. # -# An alternative way would be scan the table in order, only generating -# as many numbers are needed: +# We also have two different solutions: # -# * Assume i <= j (else, just swap i and j) +# A naive one, which calculates all numbers p = n * m, 1 <= n <= i, 1 <= m <= j, +# sorts the list, then selects the nth element. This is on ch-2b.pl. # -# * Create i pairs. Initialize each pair P_n as [n, 1], 1 <= n <= i. -# Each pair corresponds to the column in the multiplication table. -# Since the values in a column are sorted, we only need to keep -# track of the highest element we haven't descarded yet. -# * Store each pair in a heap, ordered on P_n [0] * P_n [1], such -# that the pair with the smallest product is on top. -# * Let c = 0; while c < k: -# + Let Q be the pair on top of the heap. -# + Q [1] = Q [1] >= j ? Q [i * j + 1] : Q [1] + 1 [*] -# + Restore the heap -# * If c == k, then the wanted number is product of the pair at -# the top of the heap. -# -# [*] If Q [1] >= j, we have reached the bottom of the column, so the -# answer we're seeking cannot be in this column. By setting Q [1] -# to i * j + 1, it will be larger than the answer we're looking for, -# and we'll never consult this column again. -# -# Building the heap is O (i) (trivial in this case, as we can generate -# the elements in a sorted way). Restoring the heap takes O (log (i)). -# Hence, the total running time is O (i + k * log (i)), using O (i) -# memory. +# One which goes through the multiplication table in order, avoiding +# finding divisors of numbers. This is in ch-2a.pl. # +use Math::Prime::Util qw [fordivisors]; -sub prod ($pair) {$$pair [0] * $$pair [1]} -sub left ($index) {2 * $index + 1} -sub right ($index) {2 * $index + 2} - -sub make_heap ($i) {[map {[$_, 1]} 1 .. $i]} -sub rebalance ($heap, $index = 0) { - my $index1 = left $index; # Left child - my $index2 = right $index; # Right child - return if $index1 > $#$heap; # No children, so we're done. - my $p = prod $$heap [$index]; - # - # Find the smallest of the children - # - my $p1 = prod $$heap [$index1]; - if ($index2 <= $#$heap) { - my $p2 = prod $$heap [$index2]; - # - # Right child is smaller than left child, so right child wins - # - if ($p2 < $p1) { - $p1 = $p2; - $index1 = $index2; - } - } - # - # Now, $p1 is the smallest child, and on index $index1. - # If the smallest child is smaller than the current element, - # swap, and recurse. Else, we're done. - # - if ($p1 < $p) { - @$heap [$index, $index1] = @$heap [$index1, $index]; - rebalance ($heap, $index1); - } +MAIN: while (<>) { + my ($n, $i, $j, $k) = (0, split); + fordivisors {$_ <= $i && $n / $_ <= $j && !-- $k && say $n} ++ $n + while $k >= 1; } - - -while (<>) { - my ($i, $j, $k) = split; - ($j, $i) = ($i, $j) if $j < $i; - my $heap = make_heap ($i); - while ($k -- > 1) { - $$heap [0] [1] = $$heap [0] [1] >= $j ? $i * $j + 1 - : $$heap [0] [1] + 1; - rebalance ($heap); - } - say prod $$heap [0]; -} - diff --git a/challenge-140/abigail/perl/ch-2a.pl b/challenge-140/abigail/perl/ch-2a.pl new file mode 100644 index 0000000000..bc3ef6f151 --- /dev/null +++ b/challenge-140/abigail/perl/ch-2a.pl @@ -0,0 +1,98 @@ +#!/opt/perl/bin/perl + +use 5.032; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-140/#TASK2 +# + +# +# Run as: perl ch-2a.pl < input-file +# + +# +# This solution scans the multiplication table in order, only generating +# as many numbers are needed: +# +# * Assume i <= j (else, just swap i and j) +# +# * Create i pairs. Initialize each pair P_n as [n, 1], 1 <= n <= i. +# Each pair corresponds to the column in the multiplication table. +# Since the values in a column are sorted, we only need to keep +# track of the highest element we haven't descarded yet. +# * Store each pair in a heap, ordered on P_n [0] * P_n [1], such +# that the pair with the smallest product is on top. +# * Let c = 0; while c < k: +# + Let Q be the pair on top of the heap. +# + Q [1] = Q [1] >= j ? Q [i * j + 1] : Q [1] + 1 [*] +# + Restore the heap +# * If c == k, then the wanted number is product of the pair at +# the top of the heap. +# +# [*] If Q [1] >= j, we have reached the bottom of the column, so the +# answer we're seeking cannot be in this column. By setting Q [1] +# to i * j + 1, it will be larger than the answer we're looking for, +# and we'll never consult this column again. +# +# Building the heap is O (i) (trivial in this case, as we can generate +# the elements in a sorted way). Restoring the heap takes O (log (i)). +# Hence, the total running time is O (i + k * log (i)), using O (i) +# memory. +# + + +sub prod ($pair) {$$pair [0] * $$pair [1]} +sub left ($index) {2 * $index + 1} +sub right ($index) {2 * $index + 2} + +sub make_heap ($i) {[map {[$_, 1]} 1 .. $i]} +sub rebalance ($heap, $index = 0) { + my $index1 = left $index; # Left child + my $index2 = right $index; # Right child + return if $index1 > $#$heap; # No children, so we're done. + my $p = prod $$heap [$index]; + # + # Find the smallest of the children + # + my $p1 = prod $$heap [$index1]; + if ($index2 <= $#$heap) { + my $p2 = prod $$heap [$index2]; + # + # Right child is smaller than left child, so right child wins + # + if ($p2 < $p1) { + $p1 = $p2; + $index1 = $index2; + } + } + # + # Now, $p1 is the smallest child, and on index $index1. + # If the smallest child is smaller than the current element, + # swap, and recurse. Else, we're done. + # + if ($p1 < $p) { + @$heap [$index, $index1] = @$heap [$index1, $index]; + rebalance ($heap, $index1); + } +} + + +while (<>) { + my ($i, $j, $k) = split; + ($j, $i) = ($i, $j) if $j < $i; + my $heap = make_heap ($i); + while ($k -- > 1) { + $$heap [0] [1] = $$heap [0] [1] >= $j ? $i * $j + 1 + : $$heap [0] [1] + 1; + rebalance ($heap); + } + say prod $$heap [0]; +} + diff --git a/challenge-140/abigail/perl/ch-2b.pl b/challenge-140/abigail/perl/ch-2b.pl new file mode 100644 index 0000000000..c85a59dd4c --- /dev/null +++ b/challenge-140/abigail/perl/ch-2b.pl @@ -0,0 +1,32 @@ +#!/opt/perl/bin/perl + +use 5.032; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-140/#TASK2 +# + +# +# Run as: perl ch-2b.pl < input-file +# + +# +# Trivial solution. Will easily out of memory. +# +# We'll calculate all number n * m, 1 <= n <= i, 1 <= m <= j, sort them, +# and then take the kth element. +# + +while (<>) { + my ($i, $j, $k) = split; + say +(sort {$a <=> $b} map {my $l = $_; map {$_ * $l} 1 .. $j} 1 .. $i) + [$k - 1]; +} + -- cgit From 5e0ab324c5a454538d112d0930d0fa15d6c8c4b7 Mon Sep 17 00:00:00 2001 From: Abigail Date: Thu, 25 Nov 2021 17:19:04 +0100 Subject: Extra tests for week 140, part 2 --- challenge-140/abigail/t/ctest.ini | 3 ++- challenge-140/abigail/t/input-2-2 | 4 ++++ challenge-140/abigail/t/output-2-2.exp | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 challenge-140/abigail/t/input-2-2 create mode 100644 challenge-140/abigail/t/output-2-2.exp diff --git a/challenge-140/abigail/t/ctest.ini b/challenge-140/abigail/t/ctest.ini index a0b58af962..812c315320 100644 --- a/challenge-140/abigail/t/ctest.ini +++ b/challenge-140/abigail/t/ctest.ini @@ -6,6 +6,7 @@ [names] 1-1 = Given Examples 2-1 = Given Examples +2-2 = Larger Numbers -[1-1/bc] +[1-1,2-1,2-2/bc] add_to_input = 0 diff --git a/challenge-140/abigail/t/input-2-2 b/challenge-140/abigail/t/input-2-2 new file mode 100644 index 0000000000..b0e8d5ebeb --- /dev/null +++ b/challenge-140/abigail/t/input-2-2 @@ -0,0 +1,4 @@ +100 300 5000 +300 100 5000 +1000 1000 1000000 +467 789 54321 diff --git a/challenge-140/abigail/t/output-2-2.exp b/challenge-140/abigail/t/output-2-2.exp new file mode 100644 index 0000000000..b71852ff85 --- /dev/null +++ b/challenge-140/abigail/t/output-2-2.exp @@ -0,0 +1,4 @@ +1240 +1240 +1000000 +12540 -- cgit