Problem 2025. Find the day for a date
Solution Stats
Problem Comments
-
3 Comments
I think the 22/10/1901 was a Tuesday... :-/
http://www.infoplease.com/calendar.php?month=10&year=1901&submit=Go
Its not like using datestr and solving this. You need to calculate the days and divide it by 7, take the reminder and increment that many days to present day.
Problem statement would be much better with an additional sentence:
"Solve the problem in the hypothetical world where 16 April 2019 happens on Saturday instead of Tuesday."
Otherwise this is just lame.
Solution Comments
-
3 Comments
Really, Bainhome...the problem is not 'some function you did not grasp' but the logic applied in solving this particular mathematical problem. :)
I'll suggest you take a relativistic approach as opposed to @Vivek comment. Goodluck.
To be honest, this one took me a while...and when it finished, my first thought is: code like that should considered as a crime...let me think this through.Thx man!
-
1 Comment
have to admit, this code and the one alfonso wrote are really elegant. I will look into it tomorrow.
-
1 Comment
Shame
Problem Recent Solvers34
Suggested Problems
-
1505 Solvers
-
Project Euler: Problem 10, Sum of Primes
1326 Solvers
-
530 Solvers
-
Find out sum and carry of Binary adder
1008 Solvers
-
Calculate days until Christmas
60 Solvers
More from this Author3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!