Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @EnamSon,validated by @FredericLocquet,@ManuelJ and @Harry.B.
If you have any issues, feel free to ping them.
Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @EnamSon,validated by @FredericLocquet,@ManuelJ and @Harry.B.
If you have any issues, feel free to ping them.
Hi,
Can you clarify why the valide dates with lower a to b difference are not retained in validators 4 and 6 ?
Is there a rule I missed out of month and days number limitations ?
Iām having trouble with validators 4 and 6 too. What are we missing? Can the year be greater than 9999?
No, it cannot.
Ok fro the one who are not accessing the contributionā¦
This check is not tested in any IDE test ⦠but will block you if you donāt catch it from the puzzle statements:
"I donāt know if I miss something or if validator 4 and 6 have an issue.: For validator 4 ; I found 2 dates and choose the date with min difference B-A, but i got it wrong. input : 200104091 A B abs(A-B) date
reply:
"4091, 20010 15919, ā8186-09-10ā 1 20010409 20010408 ā2001-04-09ā I have the same issue with validator 6.
4091 * 20010 = 81860910 but 8182 and 10005 are the closest factors of 81860910, not 4091 and 20010"
In other words, differently to the exemple, the numbers found through the input cut could be desqualified because those are not the reduced decomposition factors.
In the end it pushes to get a and b selected with a difference larger than the one you can find on any input decomposition.
To me at least one IDE test shall be added to cover that trap point.
my solution gives a year lower than 9999 but is not the good one because of the back door constraint not nicely clarified and not tested in the IDE, it has been spoted in the contribution but neither the IDE test cases or the statements were improved.
Rechecking the statements if the IDE are testing the point which I raised on my previous message, any coder should get the opportunity to understand his miss on puzzle loggic.
Figured it out. I do agree with @jrl86; it would be good to have the pitfall that validators 4 and 6 check for represented in the sample test cases.
@Kuhl @jrl86 how do you get valid factors ? Validators 4 and 6 have no traps. You just need to test different splits of the input to find two integers a and b that are the closest factors of the number a * b.
Example : The input is 46743363
I test different splits of input until i find two valid integers
.4 and 6743363 arenāt valid because they arenāt the closest factors of 4 * 6743363
.46 and 743363 arenāt valid for the same reason
.467 and 43363 are valid because you canāt find two divisors a and b of n = 467 * 43363 = 20250521 such that |a-b| < |467 - 43363|
Hi,
For sure if you check that a and b are the closest factors in one decomposition then you can get the good solution.
But if you slightly miss understand or go too fast in the statements (as I did) then you can understand that you need to check the closest a to b pair in the list of decompositions. This algo is giving preferential results which are all matching the current IDE tests solutions but fails validator 4 and 6.
The catch of such miss understanding is for sure difficult but I pointed out that the contribution chat have already pointed this issue and by fact there were not enough changes to avoid it to appear (at least to get IDE test catching this.
I discussed with 5DN1L who proposed to make a rebalance of the IDE / validator tests to reduce this point.
The puzzle is nice and for sure the deduction part that you may want to keep can make this type of missunderstanding
The instructions seem clear to me. I tried to provide a mathematical definition of the term āclosest factors,ā and the example in the statement seems excellent. If the problem is the rushing, I think players should try to be attentive and take their time. A puzzle doesnāt need to be solved immediately.
Modifications will be made if another player points out that validators 4 and 6 are causing problems. But I urge you to be attentive and not rush.
Sorry Iām not child urge is maybe not a good wordā¦
Yes may I was too fast but all IDE tests passed and not validators, my level allows me to spot the issue quite easily but take one player who wants to try solving this puzzle making error than me and one person in the contribution at least and with too low level to get contributions info. I would fill sorry for himā¦
Now Iām ok with statements but IDE shall catch any gap that validator chatches here I gave you info one issue if you donāt concider then you let this situation for others.
With the consent of the author of the puzzle, the cases have been revised to improve the coverage of the different scenarios. The original Validators 4 and 6 are now Tests 8 and 9, and new validators have been added.
Is anyone else having issues with the test cases for this one? When I look at the test cases and their expected output, such as for test case 2, I can see a specific date. When I run test case 2, my program prints that exact date. However, it fails, since it expects āNothingā. This applies to test cases 2, 3, 4 and 8. And when I submit my solution, I get 42%, even though my solution solves all the test cases correctly, they just seem to be buggy. Perhaps thereās a connection between this bug and the recent update of the test cases?
Hi, I also had problems passing the two validators. I think that the definition of nearest factorisation is not useful for choosing the right pair of factors if there are several. But the closest factorization is a criterion for knowing whether a pair is good.
For example, in test 5, there are two pairs that generate a date : 9/4721247 and 947/21247.
The reason why 9/4721247 is not the right pair is not that 4721247 - 9 > 21247 - 947 but that the ābestā decomposition of the product 9 4721247 = 42491223 is not 9 * 4721247 .
The best decomposition is 3^7 * 19429 (via prime factors) so 2187 * 19429 (19429 - 2187 < 4721247 - 9).
On the other hand, 21247 * 947 is the best decomposition (and the only one since both numbers are prime) of 21247947 = 20120909
If it expects āNothingā, that may mean youāve printed some extra spaces or newlines at the end. If you want, you may send me your code via private message and Iāll have a look.
Does this explanation of Test 5 help you?
Mystery
number Closest Matches
decom- factor- mystery
position Product isation number?
----------------------------------------------------------------------
9 4721247 42491223 19429 x 2187 No
94 721247 67797218 2962 x 22889 No
947 21247 20120909 947 x 21247 Yes
9472 1247 11811584 3182 x 3712 No
94721 247 23396087 8611 x 2717 No
947212 47 44518964 33829 x 1316 No
9472124 7 66304868 15083 x 4396 No
You have to determine the closest factorisation for each product because itās possible that a product can be factorised in many ways.
If you still have any issues with the validators, please tell us which ones your code fails.
Thank you, that was indeed the case. I had some leftover duplicate code that always ran, which helped pass some of the test cases, and the code that actually solves all of them nested in several conditions, however a block was indented wrong and therefore the logic only ran about half the time. So, sometimes the conditional code didnāt run, and the unconditional code solved it, or both ran, printing the result twice.
Thank you with this, I will rate it nicely as it deserves it !
For the value 328728753, we can decompose it into two sub-integers: 3287 and 28753 (|3287-28753| = |28753-3287| = 30412). This gives us the following date: 9451-11-11
If the two values āāare swapped, we obtain the new value 287533287, which will be decomposed into 2875 and 33287, resulting in a date: 9570-01-25
Both dates are correct. Which of the two is taken into account?