USACO Bronze 2015 December - Speeding
Authors: Jesse Choe, Kevin Sheng, Maggie Liu
Video Solution
By Maggie Liu
Video Solution Code
C++
Implementation
#include <bits/stdc++.h>using namespace std;const int LEN = 100;int main() {freopen("speeding.in", "r", stdin);freopen("speeding.out", "w", stdout);int N, M;
Java
import java.io.*;import java.util.*;public class Speeding {private static final int LEN = 100;public static void main(String[] args) throws IOException {BufferedReader read = new BufferedReader(new FileReader("speeding.in"));StringTokenizer initial = new StringTokenizer(read.readLine());int roadSegNum = Integer.parseInt(initial.nextToken());int bessieSegNum = Integer.parseInt(initial.nextToken());
Python
with open("speeding.in") as read:road_seg_num, speed_seg_num = [int(i) for i in read.readline().split()]limit_segs = [[int(i) for i in read.readline().split()] for _ in range(road_seg_num)]bessie_segs = [[int(i) for i in read.readline().split()] for _ in range(speed_seg_num)]
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!