USACO Silver 2019 February - Sleepy Cow Herding

Author: Qi Wang

Official Analysis

Java

Implementation

Time Complexity: O(N)\mathcal{O}(N)

//Created by Qi Wang
import java.util.*;
import java.io.*;
public class herding {
static int N;
public static void main(String[] args) throws IOException {
InputReader in = new InputReader("herding.in"); //InputReader class down below
N = in.nextInt();
int tot = 0;

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!