Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I wish they would update the compiler, I got burnt on writing a Fortran Queue that makes use of allocatable data types. I wrote it in Visual Studio, but when I copied and pasted the code it the CodeWars compiler bounced back saying it did not support allocatabled data types.
That is:
TYPE QUEUE
INTEGER:: I
TYPE(QUEUE), ALLOCATABLE:: NXT
END TYPE
Resulted in the compiler complaining:
TYPE(QUEUE), ALLOCATABLE:: NXT
is not allowed when it is part of the Fortran 2008 Standard
I think my solution correctly gives the "brute-force functions" requested in Task 1. Now I've seen other solutions the 2nd task is superfluous.
Seriously. The description makes it seem like the algorithmic complexity isn't a factor. I would have approached this problem completely differently if I'd known the "relatively small" n would timeout. A bit frustrating to be honest, especially considering how many comments are pointing this out.
Thanks!
A nice little problem that was fun finding the optimal code!
I'd just say that the numerical examples are necessary to sort out e.g. when c0 is taken.
This comment is hidden because it contains spoiler information about the solution
@Phil157 If you are stuck with the Fortran version of this Kata, feel free to post your code here and mark it as a spoiler so I can review it and perhaps provide some feedback, cheers :)
I think this output issue is due to the Fortran CW-2 testing framework itself. I'll look into improving its output by replacing special characters (such as newlines) with their escape sequence equivalents (e.g.
\n
) in my spare time.I had a random test (data = 5864, 8410, 1193, 1.5) fail with a value just below x.5000 (in both my Fortran & Excel) being rounded UP to x + 1, so I added a halfpenny!
I am asking @donaldsebleung to see your posts (he is the Fortran translator).
Outputs are different through languages.
"(3(A, I0), A)" is good practice.
In your instructions the example output, ["M: f", "B: b", "C: c"], should not have any " or , !
I see the other 2 solutions write results with format "(A, I0, A, I0, A, I0, A)", is "(3(A, I0), A)" not good practice?
Hi, I'm still stuck like my last post - sorry to send it on a weekend, I realised almost immediately after hitting "Post".
Try a different zoom level - I've just posted on a very similar problem.
Loading more items...