Skip to content

Instantly share code, notes, and snippets.

@HomoEfficio
Last active May 6, 2019 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HomoEfficio/362455acefaea8bca51453b712553dd6 to your computer and use it in GitHub Desktop.
Save HomoEfficio/362455acefaea8bca51453b712553dd6 to your computer and use it in GitHub Desktop.
NBA MVP 수상 회수 기준 내림차순 출력
use itertools::Itertools;
const MVPS: &str = concat!(
"2017-18 James Harden, Houston Rockets (Voting)\n",
"2016-17 Russell Westbrook, Oklahoma City Thunder (Voting)\n",
"2015-16 Stephen Curry, Golden State Warriors (Voting)\n",
"2014-15 Stephen Curry, Golden State Warriors\n",
"2013-14 Kevin Durant, Oklahoma City Thunder\n",
"2012-13 LeBron James, Miami Heat\n",
"2011-12 LeBron James, Miami Heat\n",
"2010-11 Derrick Rose, Chicago Bulls\n",
"2009-10 LeBron James, Cleveland Cavaliers\n",
"2008-09 LeBron James, Cleveland Cavaliers\n",
"2007-08 Kobe Bryant, Los Angeles Lakers\n",
"2006-07 Dirk Nowitzki, Dallas Mavericks\n",
"2005-06 Steve Nash, Phoenix Suns\n",
"2004-05 Steve Nash, Phoenix Suns\n",
"2003-04 Kevin Garnett, Minnesota Timberwolves\n",
"2002-03 Tim Duncan, San Antonio Spurs\n",
"2001-02 Tim Duncan, San Antonio Spurs\n",
"2000-01 Allen Iverson, Philadelphia 76ers\n",
"1999-00 Shaquille O'Neal, Los Angeles Lakers\n",
"1998-99 Karl Malone, Utah Jazz\n",
"1997-98 Michael Jordan, Chicago Bulls\n",
"1996-97 Karl Malone, Utah Jazz\n",
"1995-96 Michael Jordan, Chicago Bulls\n",
"1994-95 David Robinson, San Antonio Spurs\n",
"1993-94 Hakeem Olajuwon, Houston Rockets\n",
"1992-93 Charles Barkley, Phoenix Suns\n",
"1991-92 Michael Jordan, Chicago Bulls\n",
"1990-91 Michael Jordan, Chicago Bulls\n",
"1989-90 Magic Johnson, Los Angeles Lakers\n",
"1988-89 Magic Johnson, Los Angeles Lakers\n",
"1987-88 Michael Jordan, Chicago Bulls\n",
"1986-87 Magic Johnson, Los Angeles Lakers\n",
"1985-86 Larry Bird, Boston Celtics\n",
"1984-85 Larry Bird, Boston Celtics\n",
"1983-84 Larry Bird, Boston Celtics\n",
"1982-83 Moses Malone, Philadelphia 76ers\n",
"1981-82 Moses Malone, Houston Rockets\n",
"1980-81 Julius Erving, Philadelphia 76ers\n",
"1979-80 Kareem Abdul-Jabbar, Los Angeles Lakers\n",
"1978-79 Moses Malone, Houston Rockets\n",
"1977-78 Bill Walton, Portland Trail Blazers\n",
"1976-77 Kareem Abdul-Jabbar, Los Angeles Lakers\n",
"1975-76 Kareem Abdul-Jabbar, Los Angeles Lakers\n",
"1974-75 Bob McAdoo, Buffalo Braves\n",
"1973-74 Kareem Abdul-Jabbar, Milwaukee Bucks\n",
"1972-73 Dave Cowens, Boston Celtics\n",
"1971-72 Kareem Abdul-Jabbar, Milwaukee Bucks\n",
"1970-71 Kareem Abdul-Jabbar, Milwaukee Bucks\n",
"1969-70 Willis Reed, New York Knicks\n",
"1968-69 Wes Unseld, Baltimore Bullets\n",
"1967-68 Wilt Chamberlain, Philadelphia 76ers\n",
"1966-67 Wilt Chamberlain, Philadelphia 76ers\n",
"1965-66 Wilt Chamberlain, Philadelphia 76ers\n",
"1964-65 Bill Russell, Boston Celtics\n",
"1963-64 Oscar Robertson, Cincinnati Royals\n",
"1962-63 Bill Russell, Boston Celtics\n",
"1961-62 Bill Russell, Boston Celtics\n",
"1960-61 Bill Russell, Boston Celtics\n",
"1959-60 Wilt Chamberlain, Philadelphia Warriors\n",
"1958-59 Bob Pettit, St. Louis Hawks\n",
"1957-58 Bill Russell, Boston Celtics\n",
"1956-57 Bob Cousy, Boston Celtics\n",
"1955-56 Bob Pettit, St. Louis Hawks"
);
fn main() {
let mvps_count = MVPS.lines()
.map(|line| &line[12..line.find(',').unwrap_or(line.len())])
.into_iter()
.sorted()
.group_by(|name| *name)
.into_iter()
.map(|(key, group)| (key, group.count()))
.sorted_by(|a, b| (b.1).cmp(&a.1))
.inspect(|(key, count)| println!("{}: {}", key, count))
.map(|(_key, count)| count)
.fold(0 as usize, |a, b| a + b);
println!("{}", MVPS.lines().count() == mvps_count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment