Prime Dates

Sort by

recency

|

89 Discussions

|

  • + 0 comments

    same here: not possible in js, it expects py

    "Custom checker crashes with KeyError: u'javascript' despite correct output. Please verify language compatibility for custom checker."

  • + 0 comments

    Python: Here is the solution

    import re
    month = []
    
    def updateLeapYear(year):
        if year % 400 == 0:
            month[2] = 29
        elif year % 100 == 0:
            month[2] = 28
        elif year % 4 == 0:
            month[2] = 29
        else:
            month[2] = 28
    
    def storeMonth():
        month[1] = 31
        month[2] = 28
        month[3] = 31
        month[4] = 30
        month[5] = 31
        month[6] = 30
        month[7] = 31
        month[8] = 31
        month[9] = 30
        month[10] = 31
        month[11] = 30
        month[12] = 31
    
    def findPrimeDates(d1, m1, y1, d2, m2, y2):
        storeMonth()
        result = 0
    
        while(True):
            x = d1
            x = x * 100 + m1
            x = x * 10000 + y1
            if x % 4 == 0 or x % 7 == 0:
                result = result + 1
            if d1 == d2 and m1 == m2 and y1 == y2:
                break
            updateLeapYear(y1)
            d1 = d1 + 1
            if d1 > month[m1]:
                m1 = m1 + 1
                d1 = 1
                if m1 > 12:
                    y1 =  y1 + 1
                    m1 = 1
        return result;
    
    for i in range(1, 15):
        month.append(31)
    
    line = input()
    date = re.split('-| ', line)
    d1 = int(date[0])
    m1 = int(date[1])
    y1 = int(date[2])
    d2 = int(date[3])
    m2 = int(date[4])
    y2 = int(date[5])
    
    result = findPrimeDates(d1, m1, y1, d2, m2, y2)
    print(result)
    
  • + 1 comment

    Traceback (most recent call last): File "Solution.py", line 176, in run_custom_checker(t_obj, r_obj) File "Solution.py", line 75, in run_custom_checker system_code = code_data[t_obj.submission_language].strip() KeyError: u'csharp'

    the code is exactly 5 lines chanted I have tried comment deleted and comment present option. Still the same error. This is just stupid.

  • + 0 comments

    Missing code for Rust and C++20

  • + 1 comment

    Why hacker rank! why!

    Input (stdin) 02-08-2025 04-09-2025 Your Output (stdout) 5 Expected Output 5