USACO编程奥赛最新消息及指南

topgunll
楼主 (北美华人网)
版上好像讨论编程竞赛的不多,我来介绍一下。
USACO是所有中学生编程比赛中最重要也是影响力最大的。比赛分为开始的海选和后来的邀请训练营以及最后的国际信息奥赛。如果能进入集训营那肯定可以进名校计算机系了:)最初的海选采用自由在线的考试方式,学生在家里就可以完成。考试对所有学生免费开放,学生只要有台计算机和网络,先注册一个免费帐户就可以参加比赛。具体规则请参见http://www.usaco.org/index.php?page=instructions。USACO和大多数著名软件公司的白板面试也很类似,都是注重于算法和数据结构。 每年共有4次海选比赛时段,2020-2021赛季分别是12/18/2020-12/21/2020,1/22/2021-1/25/2021,2/26/2021-3/1/2021。每个时段每名考生有一次4小时的比赛时间,学生自己决定比赛开始时间,一旦开始就必须在4小时内结束。海选共分4级,bronze(相当于AMC10),silver(相当于AMC12),gold(相当于AIME),platinum(相当于AMO/JMO)。考生如果在某一级考试获得满分,在同一时段自动获得另一次下一级的考试机会,否则必须等本时段考试结果出来然后决定下一时段的等级。每个等级只需通过一次即可。 从历史数据来看,由于美国中学没有普及编程教育,大多数美国学校也不投入资源,其实编程竞赛的激烈程度要比数学竞赛小很多。以2018赛季为例,全美共有70000学生参加AMC10的比赛(AMC10A 40000, AMC10B 30000), 但全美参加usaco比赛的学生只有6000(第一时段2400,第二时段1900,第三时段1700)。 
USACO is the biggest and most important coding competition in US. There are 4 online open programming contests each year for all levels. Any student can take the online contests anywhere. The minimum requirement is a computer, internet, and register a free account. The contest is also very similar to software company job interview focusing on logic / algorithm / data structure. 
今年USACO比赛对数据输入/输出部分作出重大修改。As an important change from last year, ALL SUBMISSIONS NOW USE STANDARD INPUT AND OUTPUT (e.g., cin and cout in C++) instead of file input and output. You therefore no longer need to open files to read your input or write your output. As another note, participants are advised to re-read the contest rules, as we have clarified some of the key contest regulations (in particular, that use of any previously-written code or code from external sources is NOT allowed).
我写的针对这部分的简单指南: Read / write instruction for Python: Starting from this contest, there is no file in / out. Instead, you need to use input() to get each line. So input() is same as old fin.readline(). Also keep in mind that if there are multiple lines, you need multiple input(). For output, just use print(). If current line is not finished yet, use print(..., end=''). Also be very careful that print('a','b') for each comma (,) a space will be inserted into print. So for print('a','b'), the printout is 'a b'. If you do not want space as extra separator, use print(..., sep=''). Be very careful with printout format since space / newline are important. For list, print(nums) will be wrong most likely since print out format is not right. You need to print values one by one with for loop with right amount of space / new line. Another important thing is before submit your question, remember to remove all extra print since now grade server will take all print. Since this year is special, I am putting read / write part for first question for bronze level as sample code.
line=input().strip().split() nums=[int(num) for num in line] ...... (to calculate a,b,c from nums) print(a,b,c)

Read / write instruction for Java: Starting from this contest, there is no file in / out. Instead, you need to use Scanner to get each line. Also keep in mind that if there are multiple lines, you need multiple Scanner. For output, just use print() / println. Be very careful with printout format since space / newline are important. System.out.println(Arrays.toString(nums)) will be wrong most likely since print out format is not right. You need to print values one by one with for loop with right amount of space / new line. Another important thing is before submit your question, remember to remove all extra print since now grade server will take all print. Since this year is special, I am putting read / write part for first question for bronze level as sample code.
import java.util.Arrays; import java.util.Scanner;
public class abc { public static void main(String[] args) { long[] nums = new long[7]; Scanner line = new Scanner(System.in); for (int i=0; i<7; i++) { nums = line.nextLong(); } /* Calculate a,b,c from nums */ System.out.println(a+" "+b+" "+c); } } This sample code only read in 1 line of data. If you want to read in more lines, refer to this sameple code.  import java.util.Arrays; import java.util.Scanner;
class test1 { public static void main(String[] args) { /* Read in 2D array. */ int[][] nums = new int[3][3]; Scanner line = new Scanner(System.in); for (int i=0; i<3; i++) { for (int j=0; j<3; j++) { nums[j] = line.nextInt(); } line.nextLine(); } for (int i=0; i<3; i++) { System.out.println(Arrays.toString(nums)); } /* Read in multiple string */ String[] strs = new String[3]; for (int i=0; i<3; i++) { strs=line.nextLine(); } System.out.println(Arrays.toString(strs)); } }