LYNBROOK COMPUTER SCIENCE CLUB MONDAY, OCTOBER 26, 2009 POWERPOINT CREATED BY: RITIK MALHOTRA PRESENTATION BY: KARTHIK VISWANATHAN Intro to USACO.

Slides:



Advertisements
Similar presentations
Computer Science Club The best thing about a boolean is even if you are wrong, you are only off by a bit.
Advertisements

1 Streams and Input/Output Files Part 2. 2 Files and Exceptions When creating files and performing I/O operations on them, the systems generates errors.
1 Streams and Input/Output Files Part 3. 2 Handling Primitive Data Types The basic input and output streams provide read/write methods that can be used.
Taking Input Java Md. Eftakhairul Islam
Input review If review Common Errors in Selection Statement Logical Operators switch Statements Generating Random Numbers practice.
Introduction to Computer Science Robert Sedgewick and Kevin Wayne Copyright © Recursive GCD Demo public class.
Lecture 15: I/O and Parsing
Computer Programming Lab(7).
Java File I/O. File I/O is important! Being able to write and read from files is necessary and is also one common practice of a programmer. Examples include.
Chapter 10 Ch 1 – Introduction to Computers and Java Streams and File IO 1.
MOD III. Input / Output Streams Byte streams Programs use byte streams to perform input and output of 8-bit bytes. This Stream handles the 8-bit.
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 3: Program Statements 3.6 – Iterators – p
Formal Language, chapter 4, slide 1Copyright © 2007 by Adam Webber Chapter Four: DFA Applications.
Graohics CSC 171 FALL 2001 LECTURE 16. History: COBOL Conference on Data System Languages (CODASYL) - led by Joe Wegstein of NBS developed the.
Question from the last class What happens if we cast “too large” float/double to an int? int has range float a=1e10f; int b=(int)
Yoshi
1 JavaCUP JavaCUP (Construct Useful Parser) is a parser generator Produce a parser written in java, itself is also written in Java; There are many parser.
Computer Programming Lab 8.
Welcome to CodeWarmers!
CS 206 Introduction to Computer Science II 09 / 14 / 2009 Instructor: Michael Eckmann.
 We can use a combination of the File and FileOutputStream to write a series of bytes to a file.
Unit 201 FILE IO Types of files Opening a text file for reading Reading from a text file Opening a text file for writing/appending Writing/appending to.
CS 206 Introduction to Computer Science II 09 / 04 / 2008 Instructor: Michael Eckmann.
COMP 14 Introduction to Programming Miguel A. Otaduy May 17, 2004.
1 Text File I/O  I/O streams  Opening a text file for reading  Closing a stream  Reading a text file  Writing and appending to a text file.
COMP 14 Introduction to Programming Mr. Joshua Stough February 2, 2005 Monday/Wednesday 11:00-12:15 Peabody Hall 218.
String Tokenization What is String Tokenization?
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 29, 2005.
1 Text File I/O Overview l I/O streams l Opening a text file for reading l Reading a text file l Closing a stream l Reading numbers from a text file l.
1 Streams Overview l I/O streams l Opening a text file for reading l Reading a text file l Closing a stream l Reading numbers from a text file l Writing.
CS 206 Introduction to Computer Science II 01 / 23 / 2009 Instructor: Michael Eckmann.
Writing algorithms using the for-statement. Programming example 1: find all divisors of a number We have seen a program using a while-statement to solve.
Programming Contest problems Dr. Jeyakesavan Veerasamy CS faculty, The University of Texas at Dallas Website:
Using java’s Scanner class To read from input and from a file. (horstmann ch04 and ch 17)
Streams and Files CMPS Overview Stream classes File objects File operations with streams Examples in C++ and Java 2.
Two Ways to Store Data in a File Text format Binary format.
Chapter 10 Exceptions and File I/O. © 2004 Pearson Addison-Wesley. All rights reserved10-2 Exceptions Exception handling is an important aspect of object-oriented.
C# B 1 CSC 298 Writing a C# application. C# B 2 A first C# application // Display Hello, world on the screen public class HelloWorld { public static void.
Session 05 Java Strings and Files. Exercise Complete the “quick-and-dirty” class CharacterCounter containing only a main() method that displays the number.
CIS 260: App Dev I. 2 Objects and Reference Variables n Predefined Java classes you have used:  String —for defining and manipulating strings  Integer.
Moooooo Or: How I learned to stop worrying and love USACO.
Very Brief Introduction to Java I/O with Buffered Reader and Buffered Writer.
CSI 1390: Introduction to Computers TA: Tapu Kumar Ghose Office: STE 5014
Chapter 9 1 Chapter 9 – Part 1 l Overview of Streams and File I/O l Text File I/O l Binary File I/O l File Objects and File Names Streams and File I/O.
I/O in Java Dennis Burford
Please sign in on the sign up sheet MTH Computer Science Club.
20 Oct - Overview Homework #1 Group-Id rule Notes on Java text file input/output –Scanner class –Printf (like C)
File IO Basics By Dan Fleck Coming up: Data Streams.
By Rachel Thompson and Michael Deck.  Java.io- a package for input and output  File I/O  Reads data into and out of the console  Writes and reads.
Chapter 15 Text Processing and File Input/Output Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin,
CS101 Lab “File input/Output”. File input, output File : binary file, text file READ/WRITE class of “text file” - File Reading class : FileReader, BufferedReader.
Files and Streams CS /02/05 L7: Files Slide 2 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
Lecture 5 I/O and Parsing
CSI 3125, Preliminaries, page 1 Java I/O. CSI 3125, Preliminaries, page 2 Java I/O Java I/O (Input and Output) is used to process the input and produce.
BHCSI Programming Contests. Three contests Mock Contest #1  Friday, July 16 th  2:15 – 4:45pm UCF High School Online Contest  Thursday, July 22 nd.
Java Input/Output. Java Input/output Input is any information that is needed by your program to complete its execution. Output is any information that.
1 Putting Streams to use. 2 Stream Zoo C++ gives you istream, ostream, iostream, ifstream, ofstream, fstream, wistream, wifstream, istrsteam… (18) Java.
For Friday Finish reading chapter 9 WebCT quiz 17.
IO in java.
Introduction to programming in java
Reading from a file and Writing to a file
CSC305: COMPUTER PROGRAMMING II (JAVA)
I/O Basics.
תרגול מס' 5: IO (קלט-פלט) זרמי קלט וזרמי פלט ((Input & Output Streams,
הרצאה 12: קבצים וחריגות (Exceptions)
תרגול מס' 5: IO (קלט-פלט) זרמי קלט וזרמי פלט ((Input & Output Streams,
Reading and Writing Text Files
File Input and Output.
EEC 484/584 Computer Networks
CS100A Lect. 10, 1 Oct Input/Output & Program Schema
Presentation transcript:

LYNBROOK COMPUTER SCIENCE CLUB MONDAY, OCTOBER 26, 2009 POWERPOINT CREATED BY: RITIK MALHOTRA PRESENTATION BY: KARTHIK VISWANATHAN Intro to USACO

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  Registration  Training  Take the Contest 

Taking the Contest 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 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 for you to use and look through before/during/after the contest Any questions, us at 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!!