Intro to USACO - Lynbrook Computer Science

Download Report

Transcript Intro to USACO - Lynbrook Computer Science

Intro to USACO
LYNBROOK COMPUTER SCIENCE CLUB
MONDAY, OCTOBER 26, 2009
POWERPOINT CREATED BY: RITIK MALHOTRA
PRESENTATION BY: KARTHIK VISWANATHAN
Levels of Competition
 3 divisions
 Bronze, Silver, Gold
 Advancement through divisions based on points
 Qualifying round (today) determines initial division
 Bronze < Silver < Gold < USAICO (Camp) < IOI
Important Pages
 Homepage
 http://usaco.org
 Registration
 http://ace.delos.com/usacoregister
 Training
 http://train.usaco.org
 Take the Contest
 http://ace.delos.com/contestgate
Taking the Contest
 http://ace.delos.com/contestgate
 Enter Username and Password
 Select October 2009 Qualifying Round from drop-
down menu
Coding the Solution
 You will be given a problem statement
 Solves for the general case, not the specific case
given in the problem
 Take in input, spit out output
 Commented as per USACO’s rules
Sample in JAVA
/*
ID: your_username_here – you make this when you register
LANG: JAVA
TASK: put_the_task_name_here – they’ll give you this
*/
import java.io.*;
import java.util.*;
class test {
public static void main (String [] args) throws IOException {
BufferedReader f = new BufferedReader(new FileReader("test.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("test.out")));
//they’ll give you the input and output names to use
StringTokenizer st = new StringTokenizer(f.readLine()); //breaks the input line into tokens
int i1 = Integer.parseInt(st.nextToken()); //for example, grab the first integer from input
int i2 = Integer.parseInt(st.nextToken()); //grab a second integer from input
out.println(i1+i2); //enter the data into the output file, based on what they want
out.close(); //close the output file for no more entry
System.exit(0); //exit the system peacefully
}
}
Sample in C++
/*
ID: your_username_here
PROG: put_the_task_name_here
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
ofstream fout ("test.out"); //they’ll give you the output name
ifstream fin ("test.in"); //they’ll give you the input name
int a, b;
fin >> a >> b; //for example, read in two integers from input
fout << a+b << endl; //write the result into output file
return 0; //exit peacefully
}
Submitting Solution
 Submit solutions on the bottom of the ContestGate
page
 Make sure they are formatted exactly as they want it
 Cite all sources used


You are allowed to use any non-human resource on the contest
Wikipedia is really useful for pseudocode purposes for any
complex algorithms (especially ones requiring graph theory)
Additional Information
 This slide is up on http://LynbrookCS.com for




you to use and look through before/during/after the
contest
Any questions, email us at
[email protected]
http://www.usaco.org is a great resource too
Google is friend 1, Wikipedia is friend 2
Do the easy ones first

Easy = the one with least point weightage
 Good luck, contest ends tonight!!