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
반응형
'개발 > 코딩' 카테고리의 다른 글
해커랭크(HackerRank) - 2D Array - DS / C++ (0) | 2020.02.11 |
---|---|
해커랭크(HackerRank) - Weighted Uniform Strings / C++ (0) | 2020.02.06 |
해커랭크(HackerRank) - Migratory Birds / C++ (0) | 2020.02.04 |
해커랭크(HackerRank) - Mini-Max Sum / C++ (0) | 2020.02.04 |
해커랭크(HackerRank) - Divisible Sum Pairs / C++ (0) | 2020.02.03 |
댓글