[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*From*: "migu...@xxxxxxxxxxxxxxxx" <miguelraz@xxxxxxxxxxxxxxxx>*Date*: Tue, 8 Dec 2020 22:19:12 -0800 (PST)

Hello all!

This is my first attempt at seriuosly using PlusCal, and I'm trying to solve some small problems to warm up. I tried solving the first Advent of Code problem, but my PlusCal is quite rough.

Any help ?

The problem is, given a list, find 2 numbers that sum to 2020.

---- MODULE pcal ----

EXTENDS TLC, Integers, FiniteSets, Sequences

(*--algorithm pcal

variables

Sum = 2020,

Input = <<

1511,

1112,

1958,

1778,

1769,

1946,

1800,

1911,

1821,

1886,

285,

1649,

1952,

1428,

1779,

1822,

1735

>>;

begin

with x \in Input do

with y \in Input \ {x} do

assert x + y = Sum;

end with;

end with; end algorithm; *)

You received this message because you are subscribed to the Google Groups "tlaplus" group.

To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+unsubscribe@xxxxxxxxxxxxxxxx.

To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/fa41ccee-b829-4bca-8b48-23a71d863bc2n%40googlegroups.com.

**Follow-Ups**:**Re: [tlaplus] Help with Advent of Code day 01***From:*Markus Kuppe

- Prev by Date:
**Re: [tlaplus] Canonical TLA+ ... how to avoid "imperative brainwash" on KV store** - Next by Date:
**[tlaplus] Does WF and SF statements applicable in distributed Mode?** - Previous by thread:
**Re: [tlaplus] Initial state doesn't satisfy type invariant** - Next by thread:
**Re: [tlaplus] Help with Advent of Code day 01** - Index(es):