LOADING: An error occurred. Update Chrome, try Firefox, or visit this post for more details.

⚠️Reddit changed how removals work, which breaks Reveddit's website. Install the extension to track removed content:Add to chromeAdd to firefoxWhat changed?
✖︎
about reveddit
⚙F.A.Q.add-ons
r/
status
copy sharelink
[+] show filters
136
SOLUTION MEGATHREAD-🎄- 2020 Day 1 Solutions -🎄-(self.adventofcode)
submitted 5 years, 1 month ago* (edited 3 hours, 3 minutes after) by daggerdragon to /r/adventofcode (134.8k)
1384 commentsredditother-discussionssubreddit-indexmessage modsop-focus

It's been one heck of a crappy year, so let's make the holidays bright with Advent of Code 2020! If ...

... view full text

since 5 years, 1 month ago
3 of 3

Tip Reveddit Real-Time can notify you when your content is removed.

your account history
(check your username's removed content. why?)
Tip Check if your account has any removed comments.
view my removed comments
you are viewing a single comment's thread.
view all comments
[–][deleted]3 points5 years, 1 month ago* (edited 4 minutes after)

Lazarus / Free Pascal 5805/638

program advent01;
var
  src : text;
  s : string;
  data : array[1..1000] of integer;
  i,j,k : integer;
  x : integer;
  sum, prod : integer;
  count : integer;

begin
  assign(src,'input01.txt');
  reset(src);
  count := 0;
  while not eof(src) do
  begin
    inc(count);
    readln(src,x);
    writeln(x);
    data[count] := x;
  end;
  close(src);
  writeln(Count,' entries read');
  for i := 1 to count-1 do
    for j := i+1 to count do
      if (data[i]+data[j]) = 2020 then
        writeln(data[i],',',data[j],',',data[i]*data[j]);
end.
permalinkhide replies (1)as-of
[–]rabuf1 point5 years, 1 month ago

Working in a kindred language, of sorts (Ada), I felt compelled to upvote this one. I imagine you solved part 2 the same way?

permalinkparentcontexthide replies (1)author-focusas-ofpreserve
[–][deleted]2 points5 years, 1 month ago

Yes... I changed only a few lines at the end, to handle another level of loop, and to stop one earlier on the outside loop, and of course do 3 entries instead of 2

  for i := 1 to count-2 do
    for j := i+1 to count-1 do
      for k := j+1 to count do
        if (data[i]+data[j]+data[k]) = 2020 then
          writeln(data[i],',',data[j],',',data[k],',',data[i]*data[j]*data[k]);
permalinkparentcontextas-of
r/revedditremoved.substack.com
🚨 NEWS 🚨
✖︎

Important: Reddit Changed How Removals Work

A recent Reddit update makes mod-removed content disappear from profile pages, which breaks Reveddit's website.

Install the browser extension to receive removal alerts.

Add to chromeAdd to firefox

What changed?

r/revedditremoved.substack.com