USACO Bronze 2016 December - Block Game
Authors: Óscar Garries, Franek Antoniak, Dong Liu
Implementation
Time Complexity: , where is the maximum length of a string.
C++
#include <fstream>#include <iostream>#include <string>#include <vector>using std::cout;using std::endl;using std::string;using std::vector;
Java
import java.io.*;import java.util.*;public class Blocks {public static void main(String[] args) throws IOException {Kattio io = new Kattio("blocks");int n = io.nextInt();String[][] words = new String[n][];for (int i = 0; i < n; i++) {words[i] = new String[] {io.next(), io.next()};
Python
from typing import Listdef count_freq(s: str) -> List[int]:""":return: An array of length 26, containing the frequencyof each character in the given string."""freq = [0] * 26for c in s:
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!