USACO Section1.1

本系列博客主要学习和记录USACO的相关代码和总结,附上我的github地址

什么是USACO

USACO全称是The USA Computing Olympiad,主要目的是从美国高中生中选出代码能力很强的人去代表美国参加International Olympiad in Informatics,即国际信息学奥林匹克竞赛。

有关USACO Training

USACO主要面向有一到两年编程经验的,同时对编程算法有很大兴趣的人。题目难度设置合理,值得一刷。官网上建议的刷题速度是最多用两个周解决一道题,不然就太费时间了。当然了,高手是越快越好。

代码提交

USACO支持C/C++/C++11/PASCAL/Java和Python。评分系统和IOI一致。鉴于我主要用Java来刷题,这里放一个Java版的代码提交格式。

/*
ID: your_id_here
LANG: JAVA
TASK: test
*/
import java.io.*;
import java.util.*;

class test {
  public static void main (String [] args) throws IOException {
    // Use BufferedReader rather than RandomAccessFile; it's much faster
    BufferedReader f = new BufferedReader(new FileReader("test.in"));
                                                  // input file name goes above
    PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("test.out")));
    // Use StringTokenizer vs. readLine/split -- lots faster
    StringTokenizer st = new StringTokenizer(f.readLine());
						  // Get line, break into tokens
    int i1 = Integer.parseInt(st.nextToken());    // first integer
    int i2 = Integer.parseInt(st.nextToken());    // second integer
    out.println(i1+i2);                           // output result
    out.close();                                  // close the output file
  }
}

原文地址:https://www.cnblogs.com/-Sai-/p/6635259.html