From 1a4bf80d27eed8ece99c540ca5095e891fb25c61 Mon Sep 17 00:00:00 2001 From: rick Date: Tue, 9 Mar 2021 02:12:18 +0100 Subject: [PATCH] =?UTF-8?q?Premi=C3=A8re=20version=20(trop=20lente)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jour10/jour10.bs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 jour10/jour10.bs diff --git a/jour10/jour10.bs b/jour10/jour10.bs new file mode 100644 index 0000000..e4f29fa --- /dev/null +++ b/jour10/jour10.bs @@ -0,0 +1,26 @@ +basInput$ = "1113222113" +pred$ = "" +act$ = "" +new$ = "" +k = 0 + +for i = 0 to 40 + print i, " / 40" + for j = 1 to len(basInput$) step k + k = 1 + act$ = mid$(basInput$, j, 1) + pred$ = act$ + while pred$ = act$ and (j + k) < len(basInput$) + pred$ = act$ + act$ = mid$(basInput$, j + k, 1) + k = k + 1 + if act$ <> pred$ then + k = k - 1 + endif + wend + new$ = new$ + str$(k) + pred$ + next j + basInput$ = new$ + next i + +print "La longeur de la chaine finale est ", len(basInput$)