도전
1789 년 4 월 30 일부터 2019 년 8 월 21 일까지 하루에 입력을 받고 그날 미국 대통령이었던 출력으로 반환되는 프로그램을 작성하십시오.
노트
를 들어 미국 대통령의 목록 , 이름의 형식과 대통령의 기간은 아래 참조 :
April 30, 1789 - March 4, 1797 George Washington
March 4, 1797 - March 4, 1801 John Adams
March 4, 1801 - March 4, 1809 Thomas Jefferson
March 4, 1809 - March 4, 1817 James Madison
March 4, 1817 - March 4, 1825 James Monroe
March 4, 1825 - March 4, 1829 John Quincy Adams
March 4, 1829 - March 4, 1837 Andrew Jackson
March 4, 1837 - March 4, 1841 Martin Van Buren
March 4, 1841 - April 4, 1841 William Henry Harrison
April 4, 1841 - March 4, 1845 John Tyler
March 4, 1845 - March 4, 1849 James K. Polk
March 4, 1849 - July 9, 1850 Zachary Taylor
July 9, 1850 - March 4, 1853 Millard Fillmore
March 4, 1853 - March 4, 1857 Franklin Pierce
March 4, 1857 - March 4, 1861 James Buchanan
March 4, 1861 - April 15, 1865 Abraham Lincoln
April 15, 1865 - March 4, 1869 Andrew Johnson
March 4, 1869 - March 4, 1877 Ulysses S. Grant
March 4, 1877 - March 4, 1881 Rutherford B. Hayes
March 4, 1881 - September 19, 1881 James A. Garfield
September 19, 1881 - March 4, 1885 Chester A. Arthur
March 4, 1885 - March 4, 1889 Grover Cleveland
March 4, 1889 - March 4, 1893 Benjamin Harrison
March 4, 1893 - March 4, 1897 Grover Cleveland
March 4, 1897 - September 14, 1901 William McKinley
September 14, 1901 - March 4, 1909 Theodore Roosevelt
March 4, 1909 - March 4, 1913 William Howard Taft
March 4, 1913 - March 4, 1921 Woodrow Wilson
March 4, 1921 - August 2, 1923 Warren G. Harding
August 2, 1923 - March 4, 1929 Calvin Coolidge
March 4, 1929 - March 4, 1933 Herbert Hoover
March 4, 1933 - April 12, 1945 Franklin D. Roosevelt
April 12, 1945 - January 20, 1953 Harry S. Truman
January 20, 1953 - January 20, 1961 Dwight D. Eisenhower
January 20, 1961 - November 22, 1963 John F. Kennedy
November 22, 1963 - January 20, 1969 Lyndon B. Johnson
January 20, 1969 - August 9, 1974 Richard Nixon
August 9, 1974 - January 20, 1977 Gerald Ford
January 20, 1977 - January 20, 1981 Jimmy Carter
January 20, 1981 - January 20, 1989 Ronald Reagan
January 20, 1989 - January 20, 1993 George H. W. Bush
January 20, 1993 - January 20, 2001 Bill Clinton
January 20, 2001 - January 20, 2009 George W. Bush
January 20, 2009 - January 20, 2017 Barack Obama
January 20, 2017 - Incumbent Donald Trump
회장단은 첫날이 포함되고 마지막 날이 제외되도록 의도됩니다. 예를 들어, "1861 년 3 월 4 일-1865 년 4 월 15 일; 에이브 러햄 링컨"은 링컨이 1861 년 3 월 4 일 부터 1865 년 4 월 14 일 까지의 대통령임을 나타 냅니다.
이것은 각 언어에서 가장 짧은 프로그램 인 코드 골프입니다.
예
입력 : "2 월 7, 1865"출력 : "Abraham Lincoln"
WolframAlpha["president on "<>#]&
나는 순수한 Mathematica가 어딘가에 내장되어 있다고 확신하지만 그것이 무엇인지 알 때까지 W | A를 고수하고 있습니다.
WolframAlpha["US president on "<>#]&
은 출력이 정확하지 않은 원인이되게합니다.