USACO Silver 2015 December - Breed Counting

Authors: Óscar Garries (C++), Owen Wang (Java)

Official Analysis

C++

Implementation

#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("bcount.in", "r", stdin);
freopen("bcount.out", "w", stdout);
int n, q;
cin >> n >> q;

Java

Implementation

import java.io.File;
import java.io.PrintWriter;
import java.util.Scanner;
public class bcount {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(new File("bcount.in"));
PrintWriter out = new PrintWriter("bcount.out");
int N = sc.nextInt();

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!