Skip to content

Latest commit

 

History

History
199 lines (174 loc) · 6.92 KB

README.md

File metadata and controls

199 lines (174 loc) · 6.92 KB

VandyApps Code Golf Fall 2018

Overview

This competition focuses on short and succinct code. The challenge is to produce answers to the provided problems with as little code as possible. Your score for each problem will be the file size of your source code for that problem. Your code will not be run. We will assume that your code runs. We will verify the answers your code produces. However, we will have the 1st, 2nd, and 3rd place contestants run their code live for proof that it runs and proof that it produces the correct output. Submission input will be released 10 minutes before the end of the competition; example input is supplied in each problem description.

  • The actual code you submit cannot be generated text
  • Your code cannot call any external processes
  • Your code must be able to be run independently of any other personal files (i. e. you can use standard libraries and other modules but you can't write code in another file and simply call it in your submission file)

Submission

You will need to submit the source code for each question. Fork this GitHub repository, and just copy and paste your repository link here

  • Each solution file (your actual code) must be in a directory titled solutions
  • Generate answer files using your solution. The input files are in the inputs directory. Each individual input is separated by a newline. Separate your output in the file by newlines.
  • Each answer file (your generated answers) must be in a directory titled answers
  • Each file must have the problem number somewhere in its name
  • You should only submit the files we have asked for and nothing else
  • There should be no dots ("." charachters) in your filename except before the extension
  • The file size of your file will be evaluated with the python function os.path.getzise on an Ubuntu OS. Make sure this is not problematic for your source code.
  • you cannot compress your files you must submit your raw source code

Sample Valid Solution Filenames:

  • prob_1.py
  • prob1.py
  • 1.java
  • jibberish1jibberish.cpp

Sample Invalid Solution Filenames:

  • i_dont_contain_a_number.py
  • x.java
  • get.ridOfThatExtraDot.cpp
  • .filename.java

Sample Valid Answer Filenames:

  • prob_1_out.txt
  • prob1.txt
  • 1.txt
  • whatever1whatever.txt

Sample Invalid Answer Filenames:

  • i_dont_contain_a_number.py
  • x.txt
  • get.ridOfThatExtraDot.cpp
  • .filename.txt

Questions

1) ASCII Art

Print the following ASCII art:

 / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \_
/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \__
\ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / _
 \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ / 
 / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \_
/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \__
\ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / _
 \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ / 
 / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \_
/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \__
\ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / _
 \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ / 
 / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \_
/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \__
\ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / _
 \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ / 
 / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \_
/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \__
\ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / _
 \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ / 
 / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \__/ / __ \ \_
/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \____/ /  \ \__

2) Printing Integers

Print all integers (one per line) between 0 and 999,999 (do not include 0 or 999,999) that have the same first and last digit, and are divisible by 3, 5, or 7.

  • Example output:
3
5
6
7
9
33
...

3) k-th largest

Given a list of numbers and a k such that 1 <= k <= length of list, find the kth largest unique element.

  • Note the list may not be sorted and may have duplicates.

  • Input format:

T           # number of test cases
L           # list of numbers with spaces in between
k           # k
  • Example input:
1                  # 1 test case
0 3 6 2 4 3 3 7 6  # list of numbers
5                  # k
  • Example output:
2
  • Example input:
2                             # 2 test cases
3.14159 -1000 999999999 3.14  # list
3                             # k
0 0 0 0 0 0 1 -1 0 0 0 0 0 0  # list
2                             # k
  • Example output:
3.14
0

4) Unique names

Let us define Person_A ~ Person_B as true if Person_A and Person_B do not share a character at the same index. Given a list of names and a number k, print the names of the k people in which Person ~ Other_Person is true for the k highest number of Other_Person's. If there are several people in which Person ~ Other_People is true for the same amount of Other_People, then list them in alphabetical order.

  • Input format:
Name1
Name2
Name3
...
k
  • Output format:
Name1
Name2
Name3
...        # a total of k names
  • Example input:
Dan
Dylan 
Wyatt
2
  • Example output:
Dan      # Dan shares no character with Wyatt; Dan and Wyatt both share no char with 1 other person, but Dan is first (alphabetical order)
Wyatt    # Wyatt shares no character with Dan, but Dylan shares no character with no one else in the list

5) TN Universities

Print the names of all universities and colleges in Tennessee (1 per line and no abbreviations). The universities should be printed in order of the number of students, from largest to smallest.

  • Example output:
University of Tennessee: Knoxville
Middle Tennessee State University
University of Memphis
...

6) Smallest Polygon

Given a list of coordinate pairs, return the shortest sequence of points that can be connected in a loop, and such that the resulting polygon encloses all remaining points. Give the output in clockwise order, starting with the point closest to (0, 0).

  • Input format:
T                       # number of test cases
x1 y1 x2 y2 x3 y3 ...   # test case 1
x1 y1 x2 y2 x3 y3 ...   # test case 2
...                     # etc
  • Output format:
x1 y1 x2 y2 x3 y3 ...   # list of coordinates for test case 1
x1 y1 x2 y2 x3 y3 ...   # list of coordinates for test case 2
...      # etc
  • Example input:
1
1 1 2 3 3 1 2 2
  • Example output:
1 1 2 3 3 1