Skip to content

Instantly share code, notes, and snippets.

@j4nu5
Last active March 27, 2016 18:59
Show Gist options
  • Save j4nu5/55005626c282e056b753 to your computer and use it in GitHub Desktop.
Save j4nu5/55005626c282e056b753 to your computer and use it in GitHub Desktop.
Script to create solution and input files for USACO
#!/bin/bash
if [[ $# < 1 ]]
then
echo "Usage: ./solve.sh <PROBLEM_NAME>"
exit -1
fi
PROBLEM_NAME="$1"
TEMPLATE_FILE="template.cpp"
# Clone template
echo "Cloning template $TEMPLATE_FILE ..."
cp "$TEMPLATE_FILE" "$1.cpp"
sed -i -- "s/TEMPLATE/$1/g" "$1.cpp"
echo "Template successfully cloned into $1.cpp"
# Create input file
echo "Creating input file $1.in ..."
touch "$1.in"
echo "Input file $1.in successfully created"
# Success!
echo -e "\nDone! All the best!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment