Search found 22 matches

by rafastv
Fri Aug 18, 2017 10:20 pm
Forum: Volume 1 (100-199)
Topic: 172 - Calculator Language
Replies: 35
Views: 10956

Re: 172 - Calculator Language

Hi, there, a tip for you: operators should be evaluated from right to left, but brackets should be evaluated from left to right.

Cheers.
by rafastv
Sat Aug 12, 2017 5:05 am
Forum: Volume 1 (100-199)
Topic: 166 - Making Change
Replies: 31
Views: 12293

Re: 166 - Making Change

Hi, there, just so you know this is a classic DP problem, the Change-making problem. You can find the solution for unlimited coins in the YT (YouTube), for the limited case, I recommend taking the most coins possible for each value. And you will need a prune strategy, since the amount of change grow ...
by rafastv
Sun Aug 06, 2017 10:10 pm
Forum: Volume 1 (100-199)
Topic: 163 - City Directions
Replies: 24
Views: 14807

Re:


shanto86, maybe a little bit late. Try this:
Input:

A1W S50N E
TURN HALF LEFT
STOP
END

My AC program output:

A0E S50N NE

Your output:

Illegal stopping place

You may need to verify further the command read, say something like GO 12ss, GO STRAIGHT -1, TURN LEFT SHARP, TURN RIGHT xxxx ...
by rafastv
Sun Aug 06, 2017 10:08 pm
Forum: Volume 1 (100-199)
Topic: 163 - City Directions
Replies: 24
Views: 14807

Re:


Is this case allowed? What's the AC program output?
Thanks for replies.


A4W S1N SW
TURN RIGHT
TURN HALF RIGHT
TURN SHARP RIGHT
GO STRAIGHT 41
GO -32
PW
TURN RIGHT
TURN RIGHT
GO STRAIGHT 21
TURN HALF LEFT
TURN SHARP LEFT
GO ON 47
TURN HALF LEFT
OPPEKEOBWFGFXRYISILEIMFGUFRZZZDWVO
TURN SHARP ...
by rafastv
Thu Aug 03, 2017 6:04 am
Forum: Volume 1 (100-199)
Topic: 158 - Calendar
Replies: 44
Views: 15346

Re:

yiuyuho wrote: Fri Jan 17, 2003 12:37 am Will there be events that lieing over several days? Or will there be events of the same name? If so, do we need to output both of the event?

What's the output to:
1980
A 3 1 7 1-3-7
A 2 1 7 1-3-7
D 1 1
#


????????
From my AC code:

Code: Select all

Today is:  1  1
  2  1 ******* 1-3-7
  3  1 ******  1-3-7
by rafastv
Thu Aug 03, 2017 5:43 am
Forum: Volume 1 (100-199)
Topic: 158 - Calendar
Replies: 44
Views: 15346

Re: 158 - Calendar

Hi, there, my tip for you if you are suffering is to generate all dates in the range of the problem or at least one year with leap day and one year without it for all priorities in all days and then look in the generated answer for errors. And the correct order is DAY / PRIORITY / INPUT ORDER (for ...
by rafastv
Fri Jul 28, 2017 4:19 pm
Forum: Volume 1 (100-199)
Topic: 150 - Double Time
Replies: 18
Views: 7812

Re: 150 - Double Time

Hi, there, some tips for you:

1) Once you have a code that you think it is working, write a program to generate all possible dates between the range specified and check for negative numbers or zero.

2) Check for leap days, days between months and between years.

3) As said before, the first day in ...
by rafastv
Thu Jul 27, 2017 5:09 am
Forum: Volume 1 (100-199)
Topic: 149 - Forests
Replies: 37
Views: 11104

Re:


Could anyone tell me why that x & y only have to count to 20??


Because of the limited range of the problem (0.nn), you will be able to test all cases once you have a solution, and after 20 steps the algorithm just do updates to the sight of the trees but adds no new tree. It seems that to get ...
by rafastv
Thu Jul 27, 2017 3:15 am
Forum: Volume 1 (100-199)
Topic: 149 - Forests
Replies: 37
Views: 11104

Re: 149 - Forests

Hi, there, some tips for you.

1) Precision matters, I've used 1e-9

2) Don't compute the angle, use cos, sin or tan.

3) Use your own PI, I've used #define PI 3.14159265358979323846264338327

4) You should not only consider trees that are too small and gaps that are too small, but beyond that ...
by rafastv
Thu Jul 20, 2017 11:44 pm
Forum: Volume 1 (100-199)
Topic: 143 - Orchard Trees
Replies: 90
Views: 26962

Re: 143 - Orchard Trees

Hi, there, some tips for you if you suffered with this problem.

1) You must consider lines and points too besides triangles.

2) Pay attention to PRECISION of your floating-point variables, 1e-9 is enough.

3) Try at first solving the problem through brute force and when you are able, only then ...
by rafastv
Mon Jul 17, 2017 6:37 am
Forum: Volume 1 (100-199)
Topic: 140 - Bandwidth
Replies: 49
Views: 16263

Re: 140 - Bandwidth

Hi, some tips for you.

1) Do not assume the 8 nodes will be the 8 first letters of the alphabet.

2) Strip spaces from the line (A: B; C : D => A:B;C:D).

3) There may be repeating neighbors like A:BB.

4) Beware of Maximal Cliques (you should think of a way to avoid them and gain some speed up).
by rafastv
Sat Jul 15, 2017 2:23 pm
Forum: Volume 1 (100-199)
Topic: 137 - Polygons
Replies: 44
Views: 11351

Re: 137 - Polygons

Hi, some tips for you. There are several methods to approach this problem, but I recommend:

1) Implement a method for triangulation. Some triangles will belong to the intersection and some to the union (you'll need a way to find out which ones are in one or the other).

2) Implement a method for ...
by rafastv
Sat Jul 15, 2017 12:21 am
Forum: Volume 1 (100-199)
Topic: 138 - Street Numbers
Replies: 93
Views: 21188

Re: 138 - Street Numbers

Hi, some tips for you:

1) This is a non-linear diophantine equation, a Pell's equation, there is many methods to solve this kind of equation. Search one, implement it and enjoy. (There is not a general method for non-linear diophantine equations.)

I recommend reading B. Sury's paper: http://www ...
by rafastv
Sun Jul 09, 2017 5:09 am
Forum: Volume 1 (100-199)
Topic: 135 - No Rectangles
Replies: 24
Views: 10619

Re: 135 - No Rectangles

If you are stuck in this problem some tips for you:

1) DO NOT TRY BRUTE FORCE testing for rectangles or creating all of them, O(nˆ4) and O(nˆ3) is too much for this algorithm.

2) Look into projective spaces (study about them a little if you need, lot of videos in YouTube). The FANO plane is a ...
by rafastv
Sun Jul 02, 2017 11:18 pm
Forum: Volume 1 (100-199)
Topic: 132 - Bumpy Objects
Replies: 38
Views: 10690

Re: 132 - Bumpy Objects

Just some tips for you:

1) The center of mass is not always inside the object nor even the convex hull.

2) It really does help plotting all problems that deal with geometry using maybe an on-line tool (or some library)
https://www.math10.com/en/geometry/geog ... gebra.html

Go to advanced search