본문 바로가기
개발/코딩

해커랭크(HackerRank) - Day of the Programmer / C++

by lucidmaj7 2020. 2. 5.
728x90
반응형

문제 : 해커랭크  - Migratory BirdsDay of the Programmer

난이도: Easy

언어 : C++

// Complete the dayOfProgrammer function below.
string dayOfProgrammer(int year) {
    string day;
    if(year == 1918)
        return  day="26.09."+ to_string (year);
    if ((year < 1918 && year % 4 == 0) 
    || (year % 4 == 0 && year % 100 != 0) 
    || year % 400 == 0) 
    {
        
        day="12.09."+ to_string (year);
    }else {
        day="13.09."+ to_string (year);
    }

        return day;
}

 

https://en.wikipedia.org/wiki/Day_of_the_Programmer

 

Day of the Programmer - Wikipedia

The Day of the Programmer is an international professional day that is celebrated on the 256th (hexadecimal 100th, or the 28th) day of each year (September 13 during common years and on September 12 in leap years). It is officially recognized in Russia.[1]

en.wikipedia.org

 

728x90
반응형

댓글